good question #2
another solution (derek, recitation 2)
- and this?
(define (display-exp x k)
(define (helper k s)(if (= k 0) (say x k s)
(helper x (- k 1) (* x s))))
(define (say a b c)
(begin (display a) (display “ to the “) (display b) (display “ is “ ) (display c)))
(helper k 1))
- no, this won’t work (and it’s ugly anyway)!
- the k in (say x k s) is evaluated before say is applied
-