University of Virginia Computer Science
CS150: Computer Science, Fall 2005
|
(none)
7 October 2005
|
CS150 Notes 19
(7 October 2005)
Upcoming Assignments
- Before 11:59pm Sunday: If you don't want to be assigned a partner
for PS5, send me email with your choosen partner (or that you want to
work alone) and your answer to Question 4.
- Monday, 17 October: PS5
- Before Friday, 23 October: Read rest of GEB part I (Chapters 2-4
and 6-9, in addition to Chapters 1 and 5 you have already read). See
the study guide questions on Notes 18. I
recommend reading a chapter every few days rather than trying to read it
all just before October 23.
Notes
Places, Frames and Envrionments
- Names identify places. (define x
exp) and (lambda (x) exp)
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
- 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
Why must expressions be evaluated in an environment?
How do we find the value associated with a name in an environment?
include('logos.php') ;
mt_srand( (double) microtime() * 1000000) ;
$first = mt_rand( 0, ($resTotal - 1) ) ;
print ("");
?>