<div>Hi Marco</div> <div> </div> <div>Everything you told me makes perfect sense to me now. I just wasn't used to the idea of recursion.</div> <div> </div> <div>I can picture a function with one recursion is something. I picture the inputs cycling back to the top of the function, one by one, like people riding a Ferris wheel. The syntax still looks kind of paradoxical to me, but I can say, OK it's just circling around.</div> <div> </div> <div>Two recursions, on the other hand, are totally beyond me. My mind just goes blank. I realize that I should try to think of each function separately, but it is still very confusing. </div> <div> </div> <div>You gave me the following advice, which ALMOST did the trick:</div> <div> </div> <div>"Here is where I believe you are really stuck....How do you insert a letter everywhere in (rest a-word)? Once you have this list <U>(call it R)</U> all you need is to
do something with (first a-word). Where does it have to go in each of R?"</div> <div><BR>When you said, "call it R," I did get a sort of picture in my mind of the result of the recursion as a unit, a thing, instead of all these arrows going around in circles all over the place. </div> <div> </div> <div>Then, in your last email, you basically gave me the answer by saying:</div> <div>"It is easy to do using (add-letter-to-all <letter><list-of-words>). What you need now is to create all the words possible from letter and (rest a-word)." </div> <div> </div> <div>At that point it became clear to me how I could plug in "insert...(rest word)" into <list-of-words>, just like any list.</div> <div> </div> <div>I personally think that Matthias's idea of tables is probably the best way to explain these recursive helper functions. </div> <div> </div> <div>The problem was that he didn't really
explain the fourth table to me. Hopefully in HtDP/2 he will flesh it out like the way you explained it. Section 12.2 could include an introduction like this: </div> <div> </div> <div>"This section is about Recursive Auxiliary functions. We have already used basic recursion in functions that process lists. Now we are going to use recursive helper functions inside other recursive functions. </div> <div> </div> <div>"For example, A-Function is constructed with a recursive expression--A-Function (rest X)--that is input into a helper function, A-Helper, like this:</div> <div> </div> <div>(define (A-Function X) </div> <div>(...(first X)...(A-Helper (A-Function (rest X))) </div> <div> </div> <div>"The inputs to A-Function may pass through 2 or more recursive functions. For such complex problems, it is useful to use a table...."</div> <div> </div> <div>...And explain
clearly what the fourth column of the table is all about. </div> <div> </div> <div>Thanks again for your help,</div> <div> </div> <div>cooke</div> <div> </div> <div> </div> <div>In fact, I should have figured it already from reading Section 12.2, Recursive Auxiliary Functions, which introduces the concept which got me stuck. </div> <div> </div> <div>Unfortunately, the Section only explains it indirectly through the problem of "insertion sort": </div> <div> </div> <div>"Inserting a number into a sorted list isn't a simple task. We may have to search through the entire list before we know what the proper place is. Searching through a list, however, can be done only with a function, because lists are of arbitrary size and processing such values requires recursive functions."</div> <div> </div> <div>In retrospect, this paragraph could have been enough to get me through 12.4.2, but at the time it just did not
impress on me the enormous leap I would have to make in my mind. </div> <div> </div> <div><BR><B><I>Marco Morazan <firstname.lastname@example.org></I></B> wrote:</div> <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Dear Cooke,<BR><BR>I am delighted that you solved the problem. Well done! :-)<BR><BR>I also thank you for that summary of your thoughts through the<BR>process. They provide me with insight as to what kind of advice works<BR>and what those who are stuck are thinking.<BR><BR>I am curious, however, about one more thing regarding the<BR>comments/ideas I provided to you. In one of my messages (the last one<BR>I believe), I tried to explain to you (in mostly prose) how the<BR>problem was decomposed into simpler and simpler problems. Was that<BR>useful at all? Did it complement the tables you were creating well or<BR>was that too abstract to be
<hr size=1>Like movies? Here's a limited-time offer: <a href="http://us.rd.yahoo.com/evt=47522/*http://tc.deals.yahoo.com/tc/blockbuster/text4.com
">Blockbuster Total Access</a> for one month at no cost.