hw13 - ;Exercise4.25...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
;; Exercise 4.25  ; The code does not work in a normal-order applicative-order   ; (see comments below) language. The maximum recursion depth   ; will be reached because the evaluation of the second   ; argument of unless will proceed forever.  ; EDIT: Forgot to answer the second question. The code works in normal-order.  ;; Exercise 4.26  (define (eval exp env)  ; . .....          ((unless? exp) (eval (unless->if exp) env))  ; . .....   (define (unless? exp) (tagged-list? exp 'unless))  (define (unless-clauses exp) (cdr exp))  (define (unless-condition clauses) (car clauses))  (define (unless-usual-value clauses) (cadr clauses))  (define (unless-exceptional-value clauses) (caddr clauses))  (define (unless->if exp)   (expand-unless-clauses (unless-clauses exp)))  (define (expand-unless-clauses clauses)   (make-if (unless-condition clauses)            (unless-exceptional-value clauses) 
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/30/2010 for the course EECS 21281 taught by Professor Harvey during the Spring '10 term at University of California, Berkeley.

Page1 / 4

hw13 - ;Exercise4.25...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online