Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In SICP 3.2, The Environment Model of Evaluation, is an environment initially the same as its first frame?

Tags:

lisp

scheme

sicp

In The Structure and Interpretation of Computer Programs part 3.2, an "environment" is defined as "a sequence of frames." But as far as I can see, the book doesn't further discuss the difference between an environment and a frame. Also, I suspect the drawings of environments conflates them with frames because books drawings are small and 2-D, and don't readily show time-evolution short of another full drawing.

So would it be correct to think of an environment at creation as being the same as its first frame? And then when any change occurs in the environment (an extant binding changed, a new binding created), the environment adds a new frame to its sequence of frames? If that understanding is NOT correct, then what exactly is the difference between an environment and a frame?

Thanks in advance for any help!

like image 436
limist Avatar asked Oct 14 '22 23:10

limist


1 Answers

The sequence of frames is the linked list (of frames) pointing 'upwards' towards the global environment. So when an environment is created (for example, in the context of a procedure binding), the 'environment' is a pointer to the frame...which in term points to the enclosing environment (or null, if the global environment).

So ... a qualified 'yes'...it's the first frame in the sense that the rest of the environment is accessible from that first frame.

Does that help?

Cordially, Dak

like image 132
Dak Avatar answered Oct 18 '22 13:10

Dak