[plt-scheme] htdp section 17.7

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Thu Jul 6 14:12:38 EDT 2006

On Jul 5, 2006, at 7:11 PM, wooks . wrote:

> http://www.htdp.org/2003-09-26/Book/curriculum-Z-H-22.html
> re 17.7.2 - Am I right to say that the data definitions for  
> parameter name and expression have to allow for "nulls".

If you mean to say that a parameter list is possibly empty, the  
answer is "in principle, yes" but you may assume that is non-empty if  
that helps you. As you may have noticed, Beginner - Intermediate  
don't allow empty parameter lists.

> I ask with particular reference to problems 3 and 5 which seem to  
> require a null parameter and a null expression respectively.


> re 17.7.3 - Can I have an example of what is required as I don't  
> sufficiently "get" the problem as it is set.
> thanks.

1. Take any program you have written. That's an example of the kind  
of information you're dealing with. Translate it into Scheme data.  
Done. Or translate it into Java data if this makes it easier for you.

2. The contract for the function is

  evaluate-with-defs : Expression List-of-definitions -> Value

But of course this only makes sense after you have defined the sets  
(classes) Expression, List-of-definitions, Value.

I recommend Value = Number to make life easy.

2a. I recommend you think of the Expression argument as the thing you  
type into the Interactions window; the List-of-definitions as the  
function definitions that you typed into the Definitions Window (and  
then you hit RUN); and the Value is what the Interaction Windows  
delivers at the end.

3. This exercise separates those who have studied the design recipe  
from those who haven't. Or those who will be great programmers from  
those who will struggle.

Just do it. -- Matthias

P.S. Students who have never programmed before but follow the DR to  
the dot tend to solve this problem in a couple of hours, max. They  
are also usually girls but that's a coincidence.

> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.