[plt-scheme] htdp 18.1.6

From: Danny Yoo (dyoo at hkn.eecs.berkeley.edu)
Date: Sun Jul 9 11:20:17 EDT 2006


On Sun, 9 Jul 2006, wooks . wrote:

>
> http://www.htdp.org/2003-09-26/Book/curriculum-Z-H-23.html#node_sec_18.1
>
> I don't feel equipped to do this as the examples from the book all involve 
> non-recursive functions.

Hi Wooks,

Are we talking about exercise 18.1.1?  I'm not sure why having recursion 
affects how you'd solve the problems.  Exercise 18.1.1 do have recursive 
functions in the second and third subproblems, but why would that cause 
difficulties?  Nothing in the question itself asks to do something wacky 
in terms of recursion.  But let's go further in this.


Would you be able to do the first subproblem, the one involving:

     (local ((define x (* y 3)))
       (* x x))


Would you be able to do the same for a different example that does involve 
functions, like this?

     (local ((define (hypotenuse a b)
               (sqrt (+ (square a) (square b))))
             (define (square x)
               (* x x)))
       (hypotenuse 3 4))


That is, if you can't do the whole problem first, try a few easier 
examples (or ask for some alternatives) to prep yourself.


Good luck!


Posted on the users mailing list.