On 30-Sep-05, at 6:02 PM, Christian wrote:
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))
In Scheme the above code is illegal. However, the compiler is more permissive than the interpreter so it does not detect the error (it sorts the bindings according to the variable dependencies so that the binding on y is performed after binding x). Moral: use the interpreter to debug your code before you compile it!
Marc