I 5. Environment as explicit parameter 2 3 This change is boring! Exactly the same functionality as #4. 5 (define (eval exp env (cond ((number? exp exp) (look (define? exp) (eval-define exp env)) 10 ((if? exp) (eval-if exp env)) ((application? exp)(apply (eval (car exp) env) (map (lambda (e)(eval 14 (else 15 (error unknown expression exp)) 16 17 (define (lookup name env) 18 (let ((binding (tal (if (null? binding) 20 unbound variable (binding-value binding)))) 23 (define (eval-define exp env) (let ((name (cadr exp)) adar eX (table-put! env name (eval defined-to-be env)) 29(define (eval-if exp env (let ((predicate (cadr exp) (consequent (caddr exp) (alternative (cadddr exp))) (let ((test (eval predicate env))) 0123436789042345678901 ((eq? test #t)(eval consequent env)) ((eq? test #f)(eval alternative env)) (else (error val not boolean: predicate)))))) (eval '(define* z*(plus* 4 5))environment (eval ' (if*(greater* z* 6)10 15)environment Index to procedures that have not changed procedure evaluator line define 3 pplication? 2344 3 apply1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 5. Environment as explicit parameter ;This change is boring! Exactly the same functionality as #4. (define (eval exp env) (cond ((number? exp) exp) ((symbol? exp) (lookup exp env)) ((define? exp) (eval-define exp env)) ((if? exp) (eval-if exp env)) ((application? exp) (apply (eval (car exp) env) (map (lambda (e) (eval e env)) (cdr exp)))) (else (error "unknown expression " exp)))) (define (lookup name env) (let ((binding (table-get env name))) (if (null? binding) (error "unbound variable: " name) (binding-value binding)))) (define (eval-define exp env) (let ((name (cadr exp)) (defined-to-be (caddr exp))) (table-put! env name (eval defined-to-be env)) 'undefined)) (define (eval-if exp env) (let ((predicate (cadr exp)) (consequent (caddr exp)) (alternative (cadddr exp))) (let ((test (eval predicate env))) (cond ((eq? test #t) (eval consequent env)) ((eq? test #f) (eval alternative env)) (else (error "val not boolean: " predicate)))))) (eval '(define* z* (plus* 4 5)) environment) (eval '(if* (greater* z* 6) 10 15) environment) Index to procedures that have not changed: procedure define? evaluator 2 line 3 if? 3 4 application? apply 4 4 3 19