[plt-scheme] htdp 18.1.6

From: wooks . (wookiz at hotmail.com)
Date: Sun Jul 9 18:02:46 EDT 2006


hi danny,

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.

regards





----Original Message Follows----
From: Danny Yoo <dyoo at hkn.eecs.berkeley.edu>
To: "wooks ." <wookiz at hotmail.com>
CC: plt-scheme at list.cs.brown.edu
Subject: Re: [plt-scheme] htdp 18.1.6
Date: Sun, 9 Jul 2006 08:20:17 -0700 (PDT)



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.