[plt-scheme] HTDP Exercise 17.1.2

From: Marco Morazan (morazanm at gmail.com)
Date: Sun Jun 21 21:38:35 EDT 2009

On Sun, Jun 21, 2009 at 8:27 PM, aditya
shukla<adityashukla1983 at gmail.com> wrote:
> I am trying to solve this particular exercise from htdp(17.1.2) .I have two
> questions here :-
> 1) In the data definition of los and lon do I have to consider the empty
> list scenario?

Is empty a los? Is empty a lon?

> 2) The design recipe before the example explains that one list can be
> considered atomic but in this case requires to extract each element from the
> two lists make a list of that and then make a list of all the lists.So how
> do I go about the recursion?

Ask yourself if you can traverse one list, say the first one (L1), and
for each element of L1 produce part of the desired result using the
second list (L2). If so, use the DR to write a function that traverses
L1. Remember that if you need to compute a partial result of arbitrary
size then you will need an auxilary function.




Posted on the users mailing list.