[plt-scheme] HtDP newbie question, 12.4.2

From: Mark Engelberg (mark.engelberg at gmail.com)
Date: Sun Mar 30 22:40:23 EDT 2008

No.  Your program does not work properly, and it has nothing to do
with the arrangements function given in the text.  The problem lies in
your functions.

Find the smallest test case which is not working.  Figure out why it
is not working.

Also, reread what I said about the general shape of the cond in
functions that process lists.

Another strategy is to make sure you have plenty of test cases that
cover the full range of inputs that your contracts permit.

Don't give up now.


On Sun, Mar 30, 2008 at 6:40 PM, Cooke Kelsey <cookekelsey at yahoo.com> wrote:
> Thanks a lot.
> Actually all my conditional statements include both "empty" and "else."
> All my helper functions test correctly.  The extra stuff only occurs when I
> run the main function, "arrangements," which was given in the text.  So
> there's nothing I can do.
> Mark Engelberg <mark.engelberg at gmail.com> wrote:
> Not to rain on your parade, because you've clearly made a significant
> leap, but your answer still has a lot of extra stuff at the end of the
> list that doesn't belong. Don't settle; keep going until you get it
> exactly right...
> Make test cases for each of your helper functions to isolate the problem.
> I notice that a couple of your helper functions don't follow the
> "design recipe". The design recipe says that the branches of the cond
> should reflect the various possibilities for your data.
> Remember, a list is either empty or (cons item list). So your cond
> always needs to address these two possibilities:
> (define (function-for-list l)
> (cond
> [(empty? l) ....]
> [else ....]))
> Don't deviate from this pattern unless you have a really, really,
> really good reason. Look at your helper functions. Some of them do
> NOT follow this pattern.
> --Mark
> On Sat, Mar 29, 2008 at 1:05 PM, Cooke Kelsey wrote:
> > Hallelujah......I've pretty much got it!
>  ________________________________
> Never miss a thing. Make Yahoo your homepage.

Posted on the users mailing list.