<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>  <DIV>&nbsp;</DIV>  <DIV><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"><BR>  <DIV>On Mar 28, 2008, at 1:24 PM, Cooke Kelsey wrote:<BR class=Apple-interchange-newline>  <BLOCKQUOTE type="cite">  <DIV>Oh right, in order to include all the words I need more than an append.&nbsp; Here's a function that adds&nbsp;a letter&nbsp;to ALL the words:</DIV>  <DIV><BR>(define (add-first-letter first-letter low)<BR>&nbsp; (cond <BR>&nbsp;&nbsp;&nbsp; [(empty? (rest low)) (list (cons first-letter low))]<BR>&nbsp;&nbsp;&nbsp; [else (cons (cons first-letter (list (first low))) (add-first-letter first-letter (rest low)))]))<BR></DIV>  <DIV>;example:</DIV>(add-first-letter 'X (list 'A 'T 'E 'Y 'W 'Z))   <DIV>;result:</DIV>  <DIV>(list (list 'X 'A) (list 'X 'T) (list 'X 'E)
 (list 'X 'Y) (list 'X 'W) (list 'X 'Z))</DIV></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV>So if you apply add-first-letter to (first word) and the result of (insert-everywhere/in-one-word (rest word)), you get back all but one of the word you want. &nbsp;Which brings me to the second question:&nbsp;</DIV>  <DIV><BR></DIV><BR>  <BLOCKQUOTE type="cite">  <DIV>&nbsp;<SPAN class=Apple-style-span style="-webkit-text-stroke-width: -1">That was a lot more complicated than I thought.&nbsp; I guess that should be a helper function.&nbsp;</SPAN></DIV>  <DIV>&nbsp;</DIV>  <DIV>However, when I try to make a main function (insert-in-single-word) that calls add-first-letter, I end up going around in the same circle as before.</DIV></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV>Because you failed to read and answer my second question. -- Matthias</DIV>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV><BR></DIV><BR>  <BLOCKQUOTE type="cite"> 
 <DIV><BR><B><I>Matthias Felleisen &lt;<A href="mailto:matthias@ccs.neu.edu">matthias@ccs.neu.edu</A>&gt;</I></B> wrote:</DIV>  <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"><BR>  <DIV>On Mar 28, 2008, at 12:34 PM, Cooke Kelsey wrote:<BR class=Apple-interchange-newline>  <BLOCKQUOTE type="cite">  <DIV>OK, here's a simple function that adds a letter to a word:</DIV>  <DIV>&nbsp;</DIV>  <DIV>(define (add-first-letter first-letter word)<BR>&nbsp; (append (list first-letter) word))</DIV></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV>That's not what I asked you to _design_. &nbsp;Please read the suggestion carefully. And again, (append (list foo) bar) is equal to (cons foo bar). Why do yu keep using append?&nbsp;</DIV>  <DIV><BR></DIV>  <DIV><BR></DIV><BR>  <BLOCKQUOTE type="cite">  <DIV>(add-first-letter 'A (list 'X 'T 'E))=(list 'A 'X 'T 'E')<BR></DIV>  <DIV>So my&nbsp;question is, where does (list 'A 'T 'E) come
 from?&nbsp;</DIV></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV>It is your sample input to the function. It says "Given" in that column.&nbsp;</DIV>  <DIV><BR></DIV><BR>  <BLOCKQUOTE type="cite">  <DIV>In your table below, you say "the recursion: "X" "TE" --&gt; "XTE" "TXE" "TEX".&nbsp; Actually I have never been able to create such a recursion.&nbsp; That's the big mystery to me.&nbsp;</DIV></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV>The purpose statement of the function tells you what the recursive call should produce. So when you code, you may assume that the recursive call works properly.</DIV>  <DIV><BR></DIV>  <DIV><BR></DIV>  <BLOCKQUOTE type="cite">  <DIV></DIV>  <DIV><BR></DIV>  <DIV>I just read Dave Yrueta's encouraging note, and he says I need to focus on your hint about adding 'A to the list, "in the simplest and most natural way."&nbsp; Well, all I can think of is to append it, like I did above.&nbsp; But there is no recursive element, and I cannot call it or
 plug it into the main recursive function.&nbsp; It is floating out in space.</DIV>  <DIV><BR><B><I>Matthias Felleisen &lt;<A href="mailto:matthias@ccs.neu.edu">matthias@ccs.neu.edu</A>&gt;</I></B> wrote:</DIV>  <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">  <DIV><BR></DIV>  <DIV>Okay you have gotten to the point where you're jumping even faster. Slogan:&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>&nbsp;furiously fast programming leads to nowhere.&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>;; ---&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>All I was getting at is a simple point:&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>Your recursive calls in insert-everywhere/one-word produced almost all the work in the recursion. Indeed, it always produces all but one word, except that the first letter from the original word is missing. Example:&nbsp;</DIV>  <DIV><BR></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;plus&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; "XATE"&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>Given the recursive result (the list of words that are too short by the first letter in the orginal word) can you design a function that adds this letter (no matter what it is) to the front of all these words you have gotten back?&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>DONE?&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>After that: what is missing?&nbsp;</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 11:51 AM, Cooke Kelsey wrote:<BR class=Apple-interchange-newline>  <BLOCKQUOTE type="cite">  <DIV>OK, that
 helps me a little.&nbsp; If I&nbsp;insert "cons (first word)," then I can rebuild the word:</DIV>  <DIV>&nbsp;</DIV>  <DIV>(define (cons-function word)<BR>&nbsp; (cond<BR>&nbsp;&nbsp;&nbsp; [(empty? (rest word)) word]<BR>&nbsp;&nbsp;&nbsp; [else (cons (first word) (cons-function (rest word)))]))</DIV>  <DIV>&nbsp;</DIV>  <DIV>(cons-function (list 'A 'T 'W)) = (list 'A 'T 'W)</DIV>  <DIV>&nbsp;</DIV>  <DIV>The problem is how to add this to a shrinking function:</DIV>  <DIV>&nbsp;</DIV>  <DIV>(define (shrinking-function s word)<BR>&nbsp; (cond<BR>&nbsp;&nbsp;&nbsp; [(empty? (rest word)) empty]<BR>&nbsp;&nbsp;&nbsp; [else (list (append (list s) word) (shrinking-function s (rest word)))]))<BR></DIV>  <DIV>(This shrinking function isn't exactly what I want, but at least it gives me (list 'X 'A 'T 'W) and (list 'X 'T 'W)).</DIV>  <DIV>&nbsp;</DIV>  <DIV>So I append them together: </DIV>  <DIV>&nbsp;</DIV>  <DIV>(append (cons-function (list 'A 'T 'W)) (shrinking-function 'X (list
 'A 'T 'W)))</DIV>  <DIV>&nbsp;</DIV>  <DIV>And I get this:</DIV>  <DIV>&nbsp;</DIV>  <DIV>(list (list 'X 'A 'T 'W) (list (list 'X 'T 'W) empty)) (list 'A 'T 'W (list 'X 'A 'T 'W) (list (list 'X 'T 'W) empty))</DIV>  <DIV>&nbsp;</DIV>  <DIV>Garbage!</DIV>  <DIV>&nbsp;</DIV>  <DIV>As a last resort, I try to combine cons and shrinking functions together:</DIV>  <DIV>&nbsp;</DIV>  <DIV>(define (cons+shrinking-function s word)<BR>&nbsp; (cond<BR>&nbsp;&nbsp;&nbsp; [(empty? (rest word)) word]<BR>&nbsp;&nbsp;&nbsp; [else (append (cons (first word) (cons+shrinking-function 'X (rest word))) (list s) (rest word))]))</DIV>  <DIV>&nbsp;</DIV>  <DIV>(cons+shrinking-function 'X (list 'A 'T 'W)) = (list 'A 'T 'W 'X 'W 'X 'T 'W)</DIV>  <DIV>&nbsp;</DIV>  <DIV>It looks kind of&nbsp;nice, but it is even further from the expected result.</DIV>  <DIV>&nbsp;</DIV>  <DIV><BR><B><I>Matthias Felleisen &lt;<A href="mailto:matthias@ccs.neu.edu">matthias@ccs.neu.edu</A>&gt;</I></B> wrote:</DIV> 
 <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">  <DIV><BR></DIV>  <DIV>How about (cons 'A (list 'X 'T)) = (list 'A 'X 'T)</DIV>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV><BR></DIV><BR>  <DIV>On Mar 28, 2008, at 10:53 AM, Cooke Kelsey wrote:<BR class=Apple-interchange-newline>  <BLOCKQUOTE type="cite">(append (list 'A) (list 'X 'T)) = (list 'A 'X 'T)<BR><BR><B><I>Matthias Felleisen &lt;<A href="mailto:matthias@ccs.neu.edu">matthias@ccs.neu.edu</A>&gt;</I></B> wrote:   <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">  <DIV><BR></DIV>  <DIV>Here is a definition of 'adding in the missing element':&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>*&nbsp;If&nbsp;a&nbsp;list&nbsp;X&nbsp;misses&nbsp;the&nbsp;symbol&nbsp;'A&nbsp;(at&nbsp;the&nbsp;front),&nbsp;how&nbsp;do&nbsp;you&nbsp;get&nbsp;a&nbsp;list&nbsp;that&nbsp;has&nbsp;the&nbsp;'A&nbsp;and&nbsp;all&nbsp;of&nbsp;X?&nbsp;</DIV> 
 <DIV><BR></DIV>  <DIV>* X = (list 'X 'T) and 'A --&gt; I want (list 'A 'X 'T). How do I do that?&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>-- Matthias</DIV>  <DIV><BR></DIV></BLOCKQUOTE>  <DIV><BR class=khtml-block-placeholder></DIV>  <HR SIZE=1>  Be a better friend, newshound, and know-it-all with Yahoo! Mobile. <A href="http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ">Try it now.</A></BLOCKQUOTE></DIV><BR></BLOCKQUOTE><BR>  <DIV><BR class=khtml-block-placeholder></DIV>  <HR SIZE=1>  Never miss a thing. <A href="http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs">Make Yahoo your homepage.</A></BLOCKQUOTE></DIV><BR></BLOCKQUOTE><BR>  <DIV><BR class=khtml-block-placeholder></DIV>  <HR SIZE=1>  Never miss a thing. <A href="http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs">Make Yahoo your homepage.</A></BLOCKQUOTE></DIV><BR></BLOCKQUOTE><BR>  <DIV><BR class=khtml-block-placeholder></DIV>  <HR SIZE=1>  Looking for last
 minute shopping deals? <A href="http://us.rd.yahoo.com/evt=51734/*http://tools.search.yahoo.com/newsearch/category.php?category=shopping">Find them fast with Yahoo! Search.</A></BLOCKQUOTE></DIV><BR></BLOCKQUOTE><BR><p>&#32;
      <hr size=1>Special deal for Yahoo! users & friends - <a href="http://us.rd.yahoo.com/evt=47521/*http://tc.deals.yahoo.com/tc/blockbuster/text3.com
">No Cost. Get a month of Blockbuster Total Access</a> now