This preview shows page 1. Sign up to view the full content.
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 arent invocations. 268...
View Full Document
- Spring '10