Problem 9 (200pts): apply lambda
!
Implement the LambdaProcedure
case in the scheme_apply
function (scheme_eval_apply.py
).
You should first create a new Frame
instance using the make_child_frame
method of the appropriate parent frame, binding formal parameters to argument values.
Then, evaluate each of the expressions of the body of the procedure using eval_all
within this new frame.
Your new frame should be a child of the frame in which the lambda is defined.
Note that the env
provided as an argument to scheme_apply
is instead the frame in which the procedure is called.
See User-Defined Procedures to remind yourself of the attributes of LambdaProcedure
.
Before writing any code, unlock the tests to verify your understanding of the question:
$ python ok -q 09 -u
Once you are done unlocking, begin implementing your solution. You can check your correctness with:
$ python ok -q 09