[plt-scheme] repl

From: Chongkai Zhu (czhu at cs.utah.edu)
Date: Sat Sep 16 22:01:10 EDT 2006

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


Posted on the users mailing list.