safe substitution
to avoid this problem
rename bound variables
eg, give helper’s parameter the name j instead of k
(define (exp x k)
(define (helper j s)(if (= j 0) s
(helper x (- j 1) (* x s))))
(helper k 1))
now do substitution as before
Previous slide
Next slide
Back to first slide
View graphic version