[gambit-list] letrec in the interpreter

Christian christian at pflanze.mine.nu
Fri Sep 30 18:47:34 EDT 2005


At 18:12 Uhr -0400 30.09.2005, Marc Feeley wrote:
>In Scheme the above code is illegal.

Ok, I also realize that the interpreter is not trying to access an 
outer binding in this case, as this code shows which gives the same 
results as before (#!unbound in the interpreter) (I imagine it works 
by assignment and uses #!unbound as default value).

(define run #f)
(let ((x -10))
   (set! run (lambda (n)
	      (define x (+ n 1))
	      (define y (+ x x))
	      (display y)
	      (newline))))

(I read that R6RS will add letrec*, and specify internal define in 
terms of it. So I guess you will change the interpreter later to use 
letrec* in this case.)

Christian.



More information about the Gambit-list mailing list