Unformatted text preview: (member? letter ’(a e i o u))) Pigl introduces recursion —a function that invokes itself. More about how this works next week. Another example: Remember how to play Buzz? You go around the circle counting, but if your number is divisible by 7 or has a digit 7 you have to say “buzz” instead: ;;;;; In file cs61a/lectures/1.1/buzz.scm (define (buzz n) (cond ((equal? (remainder n 7) 0) ’buzz) ((member? 7 n) ’buzz) (else n))) This introduces the cond special form for multi-way choices. Cond is the big exception to the rule about the meaning of parentheses; the clauses aren’t invocations. 268...
View Full Document
This note was uploaded on 02/17/2010 for the course COMPUTER S 26275 taught by Professor Harvey,b during the Spring '10 term at Berkeley.
- Spring '10