(define (h x) (* 7 x)) (h 10)
(define (f a) (* 7 (cond [(= a 3) 9] [(= a 4) 10]))) (f 3)
(define (t a) (* 7 (cond [(= a 3) 9] [(= a 4) 10] [else 11]))) (t 5)
(define (g a b c) (make-posn 10 (posn-y (cond [(= c 12) a] [else b])))) (g (make-posn 1 2) (make-posn 3 4) 11)
For the programs, don't bother with a lab2 handin.
We haven't yet talked about the design recipe for compound data in lecture. So you should suggest the following guideline: when they're writing a function that consumes a posn p, they should write (posn-x p) and (posn-y p) as a start for the function body.
Last update: Wednesday, August 27th, 2003mflatt@cs.utah.edu |