Welcome to MzScheme v371 [3m], Copyright (c) 2004-2007 PLT Scheme Inc. ; One argument eval. (eval 'a) ; => reference to undefined identifier: a (let ((a 42)) (eval 'a)) ; => reference to undefined identifier: a (define a 43) (let ((a 42)) (eval 'a)) ; => 43 ; Curious -- Seems to be current top level environ of REPL. (eval 'car) ; => # (set! car 55) (eval 'car) ; => 55 ; relaunch Scheme (define a 4) (eval 'a (scheme-report-environment 5)) ; => reference to undefined identifier: a (eval 'car (null-environment 5)) ; => reference to undefined identifier: car (let ((n (scheme-report-environment 5))) (eval '(define a 13) n) (eval 'a n)) ; => 13 (define a (scheme-report-environment 5)) (define b (scheme-report-environment 5)) (eq? a b) ; => #f (eval '(define a 13) a) (eval '(define a 14) b) (eval 'a a) ; => 13 (eval 'a b) ; => 14 ; It would seem that MzScheme's s are mutable and that ; scheme-report-environment returns a new mutable namespace. ; Maybe that is why they don't call it an environment. ; I can't see that the report is clear on whether this is right. ; I have no objections. (eval '(set! a 42) a) (eval 'a a) ; => 42 (eq? (null-environment 5) (null-environment 5)) ; => #f ((λ (e) (+ e e)) 6) ; => 12 ; Bravo!! (eval '(define a ()) a) (define sa (eval '(λ (x) (set! a x)) a)) ; => reference to undefined identifier: λ ; Bizarre! (define sa (eval '(lambda (x) (set! a x)) a)) (define ga (eval '(lambda () a) a)) (sa 43) (ga) ; => 43 a ; => # ((eval (lambda () 4))) ; => 4 ; I think the above is reasonable but I can't find it spelled out in the report. ; MzScheme does not like the peculiar form: (cond (else r)(else t)) => cond: bad syntax (`else' clause must be last) ... ; A literal reading of the report suggests it is valid, if dumb.