CS212 Exams
Spring 1999 - Prelim
2

Environment Model I


The diagram above contains two environment frames (as boxes with double lines around them), a closure (with a dotted line), and three cons-cells. The top-level frame of the environment has bindings for the symbols x and y. The symbol y is bound to a list, whereas the symbol x is bound to a closure. The environment of the closure includes a frame that binds y to a list, and has the top-level frame as its previous frame. Write two top-level definitions, one for x and one for y, that yield an environment exactly like the one shown above.


Solution

Return to CS 212 Prelim 2 - Spring 1999