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
.
Use Ok to unlock and test your code:
python ok -q 09 -u
python ok -q 09