[plt-scheme] htdp 18.1.6
> I am talking about problem 18.1.6.
>
> I feel I understand the examples given but none of them exemplify
> stepping through a function that has recursive calls like 18.1.6.
Hi Wooks,
Ack! My apologies; I should read your subject headers more clearly.
But let's pick on the poor hypotenuse example again. *grin*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define s 7)
(define (h a b)
(local ((define (h a b)
(sqrt (+ (s a) (s b))))
(define (s x)
(* x x)))
(h a b)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Given this, would you go through the evaluation of:
(h s s)
step by step until the evaluation hits the use of the inner hypotenuse
function? This example doesn't have recursion, but does do the same core
thing: it's a finger exercise on the core issue of encapulation.
Once you get this, revisit the original question, and it shouldn't be so
hard. And if you notice: the variable names for the hypotenuse problem
above are very badly named. *grin* But that's by design for the problem
to emphasize how local is being used to avoid name collision.
If you do hit problems, show how far you get and we'll see where the
confusion is.
Best of wishes!