<div>Here's an answer to your question:</div>  <div>&nbsp;</div>  <div>Q: "Can you design a function that adds a letter (no matter what it is) to the front of all these words you have gotten back?...DONE?&nbsp;After that: what is missing?"</div>  <div>&nbsp;</div>  <div>A: What's missing is the second letter, the third, etc.&nbsp;&nbsp; </div>  <div>&nbsp;</div>  <div>That is, I can add "W" to a list:</div>  <div>&nbsp;</div>  <div>&nbsp;(list 'w 'x 'a 't 'e 'r)<BR>&nbsp;(list 'w 'x 't 'e 'r)<BR>&nbsp;(list 'w 'x 'e 'r)<BR>&nbsp;(list 'w 'x 'r))</div>  <div>&nbsp;</div>  <div>But I also need "A" "T" E" "R" to be added, incrementally:</div>  <div>&nbsp;</div>  <div>&nbsp;(list 'w 'x 'a 't 'e 'r)<BR>&nbsp;(list 'w 'a 'x 't 'e 'r)<BR>&nbsp;(list 'w 'a 't 'x 'e 'r)<BR>&nbsp;(list 'w 'a 't 'e 'x 'r)</div>  <div>&nbsp;</div>  <div>Mark suggested that I look carefully at the table and see how I can "rearrange" the items in the columns to produce the result.&nbsp; Everyone seems to
 suggest that the answer is found in that table, so I have been copying it and drawing arrows between the letters.&nbsp; </div>  <div>&nbsp;</div>  <div>At this point the solution seems to be to create a second shrinking list of (rest words), flip it around backwards and then merge it into the original list.&nbsp; I've written some functions to attempt this, but nothing near the expected result.&nbsp; </div>  <div>&nbsp;</div>  <div>Marco has suggested that&nbsp;my entire approach is wrong, that I should build words correctly from the beginning instead of adding missing letters.&nbsp; </div>  <div>&nbsp;</div>  <div>I'm going to begin again from scratch and pay closer attention to the template and contracts.</div>  <div>&nbsp;</div>  <div><BR><B><I>Matthias Felleisen &lt;matthias@ccs.neu.edu&gt;</I></B> wrote:</div>  <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">  <DIV><BR></DIV>  <DIV>Why did you throw away your
 progress (add-first-letter)?&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>Why did you not answer my second question?&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>(I'll give you that much: with the two you are about 10 keystrokes from the answer.)&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>I am getting the feeling your jumping again.&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>;; ---&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>Let's step back a bit. The purpose of this extended exercise is to practice the two ideas that the book has introduced at that point:&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>1. that the design recipe works on a per function basis -- BUT YOU NEED TO STICK TO IT;&nbsp;</DIV>  <DIV>2. that the 'wish list' works -- BUT YOU NEED TO STICK TO IT. &nbsp;(If you are systematic about this, you just never forget where in the problem you are.)&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>;; ---&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>Another step back:&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>1. In case you're wondering: &nbsp;most
 people would consider this exercise way beyond a first-semester exercise. (It was on my MS exam in 1981.)&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>2. HtDP/2e will use a simpler exercise than that and push back Arrangements until students have more practice. A lot of people have problems with it though in 1-1 meetings, it's much easier to tease out the answers to these questions because the speed is higher and less frustrating.&nbsp;</DIV>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV>-- Matthias</DIV>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV><BR></DIV><BR>  <DIV>On Mar 28, 2008, at 5:35 PM, Cooke Kelsey wrote:<BR class=Apple-interchange-newline>  <BLOCKQUOTE type="cite">  <DIV>Dear Matthias / Marco,</DIV>  <DIV>&nbsp;</DIV>  <DIV>I read Marco's suggestions.&nbsp; It was very helpful to read through the whole problem again in clear English and remember how I got to the function "insert-in-single-word."&nbsp; I think I am near to the answer.</DIV> 
 <DIV>&nbsp;</DIV>  <DIV>You both ask me a similar question:<BR></DIV>  <DIV>(1) Matthias:&nbsp; Can you design a function that adds a letter (no matter what it is) to the front of all these words you have gotten back?...DONE?&nbsp;After that: what is missing?&nbsp;</DIV>  <DIV>&nbsp;</DIV>  <DIV>&nbsp;&nbsp; given: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;the recursion &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; in the final result I want&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</DIV>  <DIV>&nbsp;&nbsp;'X &nbsp; "ATE" &nbsp; &nbsp; "X" "TE" --&gt; "XTE" "TXE" "TEX" &nbsp; &nbsp; "AXTE" "ATXE" "ATXE" "ATEX"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR></DIV>  <DIV>(2) Marco: "Here is where I believe you are really stuck. It is easy to see one member of the result: (letter a-word). This puts letter before the first letter of a-word.
 Is that the only place it can go? No, it can go before any of the letters in a word and at the end of a-word. How do you insert a letter everywhere in (rest a-word)? Once you have this list (call it R) all you need is to do something with (first a-word).&nbsp; Where does it have to go in each of R?"<BR></DIV>  <DIV>&nbsp;</DIV>  <DIV>OK, here is a function which I think answers these questions:</DIV>  <DIV>&nbsp;</DIV>  <DIV>(define (add-letter-to-recursive-list letter a-word)<BR>&nbsp; (cond<BR>&nbsp;&nbsp;&nbsp; [(empty? (rest a-word)) (cons (list letter (first a-word)) empty)]<BR>&nbsp;&nbsp;&nbsp; [else (cons (cons letter a-word) (add-letter-to-recursive-list letter (rest a-word)))]))</DIV>  <DIV>&nbsp;</DIV>  <DIV>;example:</DIV>  <DIV>(add-letter-to-recursive-list 'x (list 'w 'a 't 'e 'r))</DIV>  <DIV>;answer</DIV>  <DIV>(list<BR>&nbsp;(list 'x 'w 'a 't 'e 'r)<BR>&nbsp;(list 'x 'a 't 'e 'r)<BR>&nbsp;(list 'x 't 'e 'r)<BR>&nbsp;(list 'x 'e 'r)<BR>&nbsp;(list 'x
 'r))</DIV>  <DIV><BR>Then next question is, how can I put the missing letters back on the front of these words?&nbsp; </DIV>  <DIV>&nbsp;</DIV>  <DIV>For this, I can use the "add-first-letter" function which I sent earlier to Matthias:</DIV>  <DIV>&nbsp;</DIV>  <DIV>(define (add-first-letter first-letter low)<BR>&nbsp; (cond <BR>&nbsp;&nbsp;&nbsp; [(empty? (rest low)) (cons (append (list first-letter) (first low)) empty)]<BR>&nbsp;&nbsp;&nbsp; [else (cons (append (list first-letter) (first low)) (add-first-letter first-letter (rest low)))]))</DIV>  <DIV>&nbsp;</DIV>  <DIV>Now, I can combine the two functions into a main function, "add-letter-plus-prefix":</DIV>  <DIV>&nbsp;</DIV>  <DIV>(define (add-letter-plus-prefix x a-word)<BR>&nbsp; (add-first-letter (first a-word) (Rest x a-word)))</DIV>  <DIV>&nbsp;</DIV>  <DIV>;example:</DIV>  <DIV>(add-letter-plus-prefix 'x (list 'w 'a 't 'e 'r))</DIV>  <DIV>;answer:</DIV>  <DIV>(list<BR>&nbsp;(list 'w 'x 'w 'a 't 'e
 'r)<BR>&nbsp;(list 'w 'x 'a 't 'e 'r)<BR>&nbsp;(list 'w 'x 't 'e 'r)<BR>&nbsp;(list 'w 'x 'e 'r)<BR>&nbsp;(list 'w 'x 'r))</DIV>  <DIV>&nbsp;</DIV>  <DIV>It looks nice, but the word is still shrinking away.&nbsp; I have simply added the first letter to the beginning of all the words.&nbsp; My problem is still, how can I increment the prefix in order: 'w, 'a, 't, 'e, 'r?&nbsp; </DIV>  <DIV>&nbsp;</DIV>  <DIV>At this point, I think my problem is too many levels of abstraction.&nbsp; I think that you all can see the answer very clearly, but I can't visualize multiple recursive functions.&nbsp; The tables, etc have been extremely helpful for me to develop the individual functions.&nbsp; As far as the final solution, perhaps I don't have the ability to "see" it on that level of abstraction?</DIV></BLOCKQUOTE></DIV></BLOCKQUOTE><p>&#32;
      <hr size=1>You rock. That's why Blockbuster's offering you <a href="http://us.rd.yahoo.com/evt=47523/*http://tc.deals.yahoo.com/tc/blockbuster/text5.com
">one month of Blockbuster Total Access</a>, No Cost.