This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: (display "I give up, what is it? ") (let ((correct (read))) (newline) (display "Please tell me a question whose ") (display "answer is YES for a ") (display correct) (newline) (display "and NO for a ") (display (answer next)) (display ".") (newline) (display "Enclose the question in ") (display "quotation marks.") (newline) (let ((newquest (read))) (if yn (set-yes! node (make-branch newquest (make-leaf correct) next)) (set-no! node (make-branch newquest (make-leaf correct) next))) "Thanks. Now I know better.")))))))))) (define (make-branch q y n) (list 'branch q y n)) (define (make-leaf a) (list 'leaf a)) (define animal-list (make-branch "Does it have wings?" (make-leaf 'parrot) (make-leaf 'rabbit))) (define (animal-game) (animal animal-list))...
View Full 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.
- Spring '10