CS200: Computer Science, Spring 2004
Notes: Friday 27 February 2004
- Friday, 5 March: Problem Set 5
- Before 15 March: Read rest of GEB part I (Chapters 2-4 and 6-9, in addition to Chapters 1 and 5 you have already read).
Places, Frames and Envrionments
- Names identify places. (define x expr) and (lambda (x) expr) both create places named x.
- Frames hold names. All names must be inside a frame.
- An environment is a pointer to a frame.
- All frames except the outermost frame have pointers to a parent frame.
- The global environment is a pointer to the outermost frame. The outermost frame contains all the Scheme primitives.(define nest (lambda (x) (lambda (x) (+ x x))))Compound Application Rule
Why must expressions be evaluated in an environment?
- Construct a new frame, enclosed in the environment of this procedure (that is, the parent of this frame is the frame this procedure's environment points to)
- Make places in that frame with the names of each parameter
- Put the values of the parameters in those places
- Evaluate the body in the new environment
How do we find the value associated with a name in an environment?
Using these Materials