[gambit-list] letrec in the interpreter

Christian christian at pflanze.mine.nu
Fri Sep 30 18:02:00 EDT 2005


Hello

I've noticed a discrepancy between the interpreter and the compiler:
in both of these cases:

(define (run n)
  (letrec
      ((x (+ n 1))
       (y (+ x x)))
    (display y)
    (newline)))

(define (run n)
  (define x (+ n 1))
  (define y (+ x x))
  (display y)
  (newline))

(run 1) outputs 4 when compiled. When interpreted, it gives a "number
expected, (+ #!unbound #!unbound)" exception.

(Thanks to Rickdangerous on irc for the example.)

Christian.




More information about the Gambit-list mailing list