[plt-scheme] htdp section 17.7

From: Felix Klock's PLT scheme proxy (pltscheme at pnkfx.org)
Date: Fri Jul 7 00:01:02 EDT 2006

On Jul 6, 2006, at 11:50 PM, wooks . wrote:

> Actually I do have a query on how to represent number 5 .
> (define (k w) (* (h w) (i w)))
> Is the correct representation of (* (h w) (i w)) derived by  
> substituting (h w) with a representation of  its body (which is  
> defined by number 3 below?

No.  The representation of the expression (* (h w) (i w)) is  
something that you should be able to construct without knowing the  
definition of h, for the purposes of this problem.

Another procedure will deal with substituting the representation of  
h's body as the computer evaluates the representation of an  
invocation of k.  But that is not part of your immediate concern,  
which is to represent the definition itself.

Make sure that your data definition for Expression is capable of  
representing the full range of expressions, such as:

- 1
- 2
- x
- (f y)
- (g 3)
- (* 4 z)
- (+ (* 2 3) (* 4 5))
- (h (* 3 (h 5)))

You should be able to represent all of the above without knowing the  
"definitions" for f, g, h, x, y, z, etc.


Posted on the users mailing list.