<DIV>Hi, I think I see what you are driving at.&nbsp; I&nbsp;made tables with&nbsp;the word "ATW" as you suggested,&nbsp;on a piece of paper, and drew arrows to show how the values are passed down.&nbsp; It helped me to see how&nbsp;each cycle gives me the next words in the list, minus missing letters.&nbsp; </DIV>  <DIV>&nbsp;</DIV>  <DIV>When you say this:</DIV>  <DIV>&nbsp;</DIV>  <DIV>"From ROW 1: you get a list of TWO words ("XT" "TX") back from the recursive call. But you want THREE and the words are missing the letter A, the first of the current (****)&nbsp;word. The word that is missing is "XAT" which is the old (*****) word prefixed with X, the letter to be inserted."</DIV>  <DIV>&nbsp;</DIV>  <DIV>...it seems to require a sort of register to save the current prefix, using the successive first letters of the&nbsp;"current" word ("let Z = 'A"), and each cycle increments the register ("let Z='A 'T"&nbsp; "let Z='A'T'W)&nbsp;which I then&nbsp;append to the symbol and
 the shrinking (rest word).&nbsp; </DIV>  <DIV>&nbsp;</DIV>  <DIV>I thought of your reminder to use helper functions,&nbsp;e.g. "add-prefix," but I keep going back to this register idea.&nbsp; I don't know whether I am getting off track or what.<BR><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"><BR>  <DIV>On Mar 27, 2008, at 6:22 PM, Cooke Kelsey wrote:<BR class=Apple-interchange-newline>  <BLOCKQUOTE type="cite">  <DIV>Hi, I've made some progress but no jackpot yet...</DIV></BLOCKQUOTE>  <DIV><BR></DIV>This&nbsp;is&nbsp;huge&nbsp;progress. &nbsp;Let's roll this up backwards: (see numbers)</DIV>  <DIV><BR></DIV>  <DIV><BR>  <BLOCKQUOTE type="cite">  <DIV><SPAN class=Apple-style-span style="-webkit-text-stroke-width: -1">Here are the tables with all of the values, as you suggested:</SPAN></DIV>  <DIV>&nbsp;</DIV>  <DIV>First Table:
 </DIV></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV>ROW 1:</DIV><BR>  <BLOCKQUOTE type="cite">  <DIV>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp; s&nbsp;&nbsp; |&nbsp;&nbsp; word&nbsp; |&nbsp;&nbsp; (first word)&nbsp; |&nbsp; (insert-in-single-word s (rest word)) | expected result for (insert-... s low)<BR>&nbsp; --------------------------------------------------------------------------------------------------------<BR>&nbsp;&nbsp; 'X&nbsp;&nbsp; |(list 'A 'T)|&nbsp;&nbsp;&nbsp;&nbsp; 'A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp; (list (list 'X 'T) (list 'T 'X)) |&nbsp;&nbsp; (list (list 'X 'A 'T) (list 'A 'X 'T) (list 'A 'T 'X))<BR>&nbsp;&nbsp; <BR>&nbsp; Table for Recursive Case:</DIV></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV>ROW 2:&nbsp;</DIV><BR>  <BLOCKQUOTE type="cite">  <DIV><BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp; s&nbsp;&nbsp; |&nbsp;&nbsp; word&nbsp; |&nbsp;&nbsp; (first word)&nbsp; |&nbsp; (insert-in-single-word s (rest word)) | expected result for (insert-... s
 low)<BR>&nbsp; --------------------------------------------------------------------------------------------------------<BR>&nbsp;&nbsp; 'X&nbsp;&nbsp; |(list 'T)|&nbsp;&nbsp;&nbsp;&nbsp; 'T&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;(list 'X)&nbsp;|&nbsp;&nbsp; (list (list 'X 'T) (list 'T 'X))<BR></DIV>  <DIV>&nbsp;</DIV></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV>From ROW 2: you get a list of ONE word ("X") back from the recursive call. But you want TWO words altogether and the word is missing the letter T, the first of the current word. &nbsp;The word that is missing is "XT" which is the old word prefixed with X, the letter to be inserted.&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>From ROW 1: you get a list of TWO words ("XT" "TX") back from the recursive call. But you want THREE and the words are missing the letter A, the first of the current word. The word that is missing is "XAT" which is the old word prefixed with X, the letter to be
 inserted.&nbsp;</DIV>  <DIV><BR></DIV>  <BLOCKQUOTE type="cite">  <DIV>After examining the tables, I tried a couple of new ways to get the results in the last column.&nbsp;</DIV></BLOCKQUOTE>  <DIV><BR></DIV>Do my descriptions help?&nbsp;If not, try the following input: "ATT". What is the expected result? What is first? What's the recursive result? Etc.&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>Perhaps you also want to think about how the words you get back from the recursion go into the final result.&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>;; ---&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>Don't try to code it up. Try to think it through first and come up with a description of WHAT has to happen to combine all these values properly. THEN turn this into a function with the design recipe.&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>-- Matthias</DIV>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV><BR>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV><BR></DIV> 
 <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV><BR></DIV><BR>  <BLOCKQUOTE type="cite">  <DIV></DIV>  <DIV>&nbsp;</DIV>  <DIV>The easiest way was simply to append the letters in order, so that X, AT--&gt;XAT, AXT ATX </DIV>  <DIV>&nbsp;</DIV>  <DIV>(define (insert-in-single-word2 s word)<BR>(list (append (list s) word) (append word (list s)) (append (list (first word)) (list s) (rest word))))</DIV>  <DIV>&nbsp;</DIV>  <DIV>This doesn't have any recursive part, so it only works on 3 letter words.</DIV>  <DIV>&nbsp;</DIV>  <DIV>When I tried to insert a recursive part, no matter how I arranged the parts, I always lost letters.&nbsp; </DIV>  <DIV>&nbsp;</DIV>  <DIV>For instance, the definition below results in: X,AT--&gt;XAT, ATX, X</DIV>  <DIV>&nbsp;</DIV>  <DIV>(define (insert-in-single-word s word)<BR>&nbsp; (cond<BR>&nbsp;&nbsp;&nbsp; [(empty? (rest word)) empty]<BR>&nbsp;&nbsp;&nbsp; [else (list (append (list s)
 word) (append word (list s)) (append (list s) (insert-in-single-word s (rest word))))]))<BR></DIV>  <DIV><BR><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>On Mar 27, 2008, at 3:15 PM, Cooke Kelsey wrote:<BR><BR>&gt; (1) At this point it becomes critical to spell out the (list ...) <BR>&gt; stuff, i.e., to turn the example into full-fledged Scheme data. <BR>&gt; Small step.<BR>&gt;<BR>&gt; (.......which Scheme displays as (cons (cons 'X (cons 'A (cons 'T <BR>&gt; empty))) (cons (cons 'A (cons 'X (cons 'T empty))) (cons (cons 'A <BR>&gt; (cons 'T (cons 'X empty))) empty)))....)<BR><BR>I recommend raising the language level to Beginner with List ..<BR><BR><BR>&gt; (4) And before you complete the template build a table just like <BR>&gt; the one above for the recursive case.<BR>&gt;<BR>&gt;
 First Table:<BR>&gt;<BR>&gt; s | word | (first word) | (insert-in-single-word s (rest <BR>&gt; word)) | expected result for (insert-... s low)<BR>&gt; ---------------------------------------------------------------------- <BR>&gt; ----------------------------------<BR>&gt; 'X |(list 'A 'T)| 'A | (insert-in-single-word s <BR>&gt; (list 'T) | (list (list 'X 'A 'T) (list 'A 'X 'T) (list 'A 'T 'X))<BR><BR><BR>What is the VALUE of (insert-in-single-word s (list 'T) ) ? The <BR>purpose statement tells you!</DIV>  <DIV>&nbsp;</DIV>  <DIV><BR><BR>&gt; Table for Recursive Case:<BR>&gt;<BR>&gt; s | word | (first word) | (insert-in-single-word s (rest <BR>&gt; word)) | expected result for (insert-... s low)<BR>&gt; ---------------------------------------------------------------------- <BR>&gt; ----------------------------------<BR>&gt; 'X |(list 'T)| 'T | (insert-in-single-word s empty <BR>&gt; | (list (list 'X 'T) (list 'T 'X))<BR><BR>What is the VALUE of (insert-in-single-word 'X
 empty) ? The purpose <BR>statement tells you!</DIV>  <DIV>&nbsp;</DIV>  <DIV><BR>&gt; I feel I am getting closer to the answer. The second table <BR>&gt; suggest to me that there is something about recurring down to 2 <BR>&gt; letters and then appending the rest on.....except that I lost the <BR>&gt; rest of the letters.<BR><BR>Almost! You need to actually determine the value of these expressions <BR>not just write down the expressions to make the leap. You're almost <BR>there.<BR><BR>And don't forget: if the leap is to large, you may need yet another <BR>helper function.<BR><BR>-- Matthias<BR><BR><BR><BR></DIV></BLOCKQUOTE><BR>  <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><p>&#32;

      <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>