good question #1
alternative solution (derek, recitation 2)
- how about this?
(define (display-exp x k)
(define (helper k s)(if (= k 0) (say s)
(helper x (- k 1) (* x s))))
(define (say result)
(begin (display x) (display “ to the “) (display k) (display “ is “ ) (display result)))
(helper k 1))
- fine, because k in body of result is bound to k parameter of display-expscope of helper’s k is body of helper alone
-