[plt-scheme] Re: HTDP Exercise 12.4.2 ... Help! (Solved!!)
I just wanted to update this topic in order to say that I have finally
solved this exercise the *correct* way! Thank you very much to
everyone here who provided input.
For anyone who finds this topic and is looking for help with this
exercise:
1. Learn the right way to think about recursion. Don't make the
mistake I made and try to put the entire recursive process into your
head all at once. It simply doesn't work. Even writing down all of the
results of the recursion step-by-step won't help. Instead, use the
definition of the function itself to understand how the recursion
works, and then create the rest of the function as if the recursive
call already does what it's supposed to do.
2. Follow the design recipes. This exercise is probably the first one
in the book where you pretty much have to use the design recipes in
order to find the right solution. The specific recipe you should be
looking at here is in section 9.4
3. Walk away from this exercise if/when you get frustrated. Take a
walk, watch a movie, etc. Basically, go do something that doesn't
require a lot of thinking.
4. Don't give up on it until you have the solution. It's worth it once
you solve it because you gain a better understanding of how to use and
think about recursion, and how to use the design recipes.