I'd like to offer some advice for those that may struggle with this one:
- This exercise is there to make sure you are using the design
recipes. If you've gone this far without using the design recipes,
you are doing it wrong. While going through the initial chapters I
thought "yeah--these are cute and probably good for newbies that need
their hand held". Count me among the newbies. I'm a convert to the
design recipes.
- Specifying the contract and purpose statement for each function you
create is instrumental in solving this exercise. They let you know
exactly where you are, what you should be producing, and provide hints
on where to go next.
- Remember the wish lists.
- Examples and tests are important! Using check-expect is what
finally got me to the finish line.
- If you are working from the hard copy of the text book, you should
visit the book's site--the online version contains fixes to errata in
the dead tree version that will leave you scratching your head. This
exercise has a helpful tip on the online version.
Most of this is probably obvious stuff to most of you, but it took
this exercise to drill in the importance of these things for me.
On a side note, if you are self-studying and find yourself struggling,
I urge you not to give up. It's very easy to set the book down and go
chase the latest shiny thing. This exercise took me much longer than
I'd like to admit, but once I got it, a huge light bulb went on.
Right now I've managed to get 1/4 of the way through HtDP with self
study. I've done every exercise so far, and I can tell you that it's
worth it: I've found myself using the design recipes at work, and
they've helped. You can do it too.
Good luck,
MJ
Ask yourself these questions: What data structures am I consuming?
What data structures am I producing? What are the design recipes for
those? What are the templates? What does the data look like going in
(examples)? What should the produced data look like (examples)? What
tests could you create to verify that the examples are produced
correctly? Take it one step at a time and don't forget the wish lists.
In one of the threads on the PLT mailing list Matthias mentions that
it is a pretty hard exercise and that "HtDP/2e will use a simpler
exercise than that and push back Arrangements until students have more
practice". Despite that, I think it's a valuable exercise for
breaking you out of the imperative mindset.
MJ