an evaluator for scheme
- the code
(define mc-eval (lambda (exp env)
(cond ((number? exp) exp) ;base-case
((symbol? exp) (lookup exp env)) ;base case
((eq? (car exp) 'quote) (car (cdr exp))) ;special forms
((eq? (car exp) 'cond) (evcond (cdr exp) env))
((eq? (car exp) 'begin) (evseq (cdr exp) env))
((eq? (car exp) 'lambda) (list 'proc (cdr exp) env))
((eq? (car exp) 'define) (evdefine (cdr exp) env))
(else (mc-apply (mc-eval (car exp) env)
(evlist (cdr exp) env))))))
- features to look out for
the recursive structure: where are the base cases?
the call to mc-apply
how procedures are represented
how the environment is passed through