[plt-scheme] repl

From: Jos Koot (jos.koot at telefonica.net)
Date: Sun Sep 17 14:25:12 EDT 2006

This works:

 (let ((standard-eval (current-eval)))
  (lambda (e)
   (parameterize ((current-eval standard-eval))
    (eval e)))))

Succes, Jos Koot

((((lambda(x)((((((x x)x)x)x)x)x))
   (lambda(x)(lambda(y)(x(x y)))))
  (lambda(x)(write x)x))
 "greetings, Jos") 
----- Original Message ----- 
From: "Chongkai Zhu" <czhu at cs.utah.edu>
To: <plt-scheme at list.cs.brown.edu>
Sent: Sunday, September 17, 2006 4:01 AM
Subject: [plt-scheme] repl

> The following code causes an infinite loop:
> (define ns (make-namespace))
> (parameterize ((current-prompt-read read)
>                (current-eval
>                 (lambda (e)
>                   (eval e ns))))
>   (read-eval-print-loop))
> The reason is that when doing the (eval e ne), the eval refers to the 
> (current-eval) again. Although the intension is simple: starting a repl 
> that eval in a specific namespace, it doesn't work this way.
> Of course I can copy the souce code of the read-eval-print-loop (it's 
> 35-line Scheme code), modify it by changing the (current-eval) in it. 
> But is there any better way?
> Thanks.
> Chongkai
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.