12.4.2

17 views
Skip to first unread message

Inching Forward

unread,
Mar 13, 2009, 9:34:48 PM3/13/09
to study...@googlegroups.com
I just finished exercise 12.4.2. I can't lie--12.4.2 handed me my
butt several times before I figured it out. I got frustrated and set
the book down more than once. Getting into the functional / recursive
style is difficult for this long-time imperative, OO, average Java
programmer.

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

mike

unread,
Mar 15, 2009, 8:30:44 PM3/15/09
to Study-HTDP
When one is self-studying it is easy to become distracted by other
material.
For instance i studied chapter 1 of sicp and essentially got seduced
by the
domain knowledge required and hence lost my perspective. So i am back
and
really studying the recipes and will not allow myself to get
distracted by
other material about scheme or com sci.
mike

Grant Rettke

unread,
Mar 23, 2009, 9:28:43 PM3/23/09
to Study-HTDP
On Mar 13, 8:34 pm, Inching Forward <inchingforw...@gmail.com> wrote:
> Good luck,

Thanks MJ. I am on this problem now.

mike

unread,
Mar 30, 2009, 8:20:39 PM3/30/09
to Study-HTDP
I now know what you mean ; i just entered this section and looks
scary!!
mike

mike

unread,
Apr 5, 2009, 9:56:33 PM4/5/09
to Study-HTDP
Well i went through section 12 and absolutely hit a brick wall on
problem 12.4.2 and feeling discouraged. I'm wondering for those who
are ahead of me; can i just move on and return to this problem or does
the problem represent a core knowledge in order to understand the
subsequent
sections?
mike

Grant Rettke

unread,
Apr 5, 2009, 10:53:15 PM4/5/09
to Study-HTDP
Hi Mike,

I am still working on it. There are a few threads on 12.4.2 in the PLT
mailing list. They are worth reading.

I am not going to move on; I'm just going to stick with this. I figure
it is not a race and I want to see
if I am really learning how to apply the recipes or not.

mike

unread,
Apr 5, 2009, 10:56:09 PM4/5/09
to Study-HTDP
thanks grant

Inching Forward

unread,
Apr 6, 2009, 11:41:08 AM4/6/09
to study...@googlegroups.com
Hey Mike:

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

mike

unread,
Apr 6, 2009, 6:27:25 PM4/6/09
to Study-HTDP
Thanks mj ,
mike

On Apr 6, 8:41 am, Inching Forward <inchingforw...@gmail.com> wrote:
> Hey Mike:
>
> 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
>
Reply all
Reply to author
Forward
0 new messages