CS212
Exams
Spring
1999 -
Final
Suppose we execute the following Scheme definitions and expressions in the standard top-level environment. Draw a picture of the resulting environment (as done in class) and give the final value that results from evaluating all of the expressions. Your picture does not need to include environment frames that can be garbage collected.
(define x empty) (define m (lambda () (let ((c (let ((x 1)) (lambda () (set! x (+ 1 x)) x)))) (set! x (cons c x)) c))) (define c1 (m)) (define c2 (m)) ((head x))