an applier for scheme
- the code
(define mc-apply (lambda (fun args)
(cond ((not (pair? fun)) (apply fun args)) ;ground out
((eq? (car fun) 'proc)
(mc-eval (car (cdr (car (cdr fun)))) ; procedure body
(bind (car (car (cdr fun))) ;formal params
args ;supplied args
(car (cdr (cdr fun)))))) ;saved env (else (error '"Unknown function")))))
- features to look out for
the recursive structure: where are the base cases?
the call to mc-eval
how procedures are applied
how the environment is passed through