[plt-scheme] HTDP Section 22.1 some confusion...
>>Hi,
>>I'm a bit confused by the evaluation example given for the application of add to a number.
>>please forgive my notation, I've started my lines with >>
(define (add x)
(local ((define (x-adder y) (+ x y))) x-adder))
>>So we've got add which I think I understand fine, and now we're defining f as an application of add to a number.
(define f (add 5))
= (define f (local ((define (x-adder y) (+ 5 y))) x-adder))
>>so far so good...
= (define f (local ((define (x-adder5 y) (+ 5 y))) x-adder5))
>> ^? ^?
>>now what I don't understand is where the 5 in x-adder5 comes from.
>>There's nothing actually called x-adder5, right? that line could equally say
>>= (define f (local ((define (add5please y) (+ 5 y))) add5please))
>>It's not like you can call (x-adder5 20) is it? you can only invoke x-adder5 with (f x)
>>x-adder5 is just there to show that the newly defined function has the formerly free variable x now fixed to 5
>>please let me know If I've got this the right way round in my mozgy gulliver.