|
Ok, I'm lost. I figured out roughly how O'Donnell-LISP 1.3 evaluates lambda expressions. The dynamic scope seems to come from the fact that extenv places new bindings in the head of the list, and the eval function picks the first instance of a binding that occurs in the environment. Also, the eval-apply construct binds all the variables in a lambda expression's parameter list just before executing the body of the lambda expression. This means that if the same variable name is used as a parameter in a nested lambda expression, the latest binding will be the one used in the evaluation of the innermost lambda expression, which means the scope is dynamic. That is where I become lost. I don't understand Prof. O'Donnel's suggestion about bundling an environment with a function. I thought the idea of function application was to evaluate a function is a given environment, not an environment that comes with the function. The only other solution I can think of is to place new bindings on the tail of the environment, but this solves the problem only by crippling the rest of the system (since this way you could only assign a value to a variable once, and then never change it). Can someone guide me to the light of truth? Thanks. roni |
Environments and Arglists... by Gregory Kettler, 2001, Nov 18
functional vs. imperative by Roni Choudhury, 2001, Nov 18
to: