<DIV>(1) At this point it becomes critical to spell out the (list ...) stuff, i.e., to turn the example into full-fledged Scheme data. Small step.&nbsp;</DIV>  <DIV>&nbsp;</DIV>  <DIV>OK, here it is:</DIV>  <DIV>&nbsp;</DIV>  <DIV>; Example: (define (insert-in-single-word 'X (list 'A 'T).&nbsp; </DIV>  <DIV>Result should be (list (list 'X 'A 'T) (list 'A 'X 'T) (list 'A 'T 'X))</DIV>  <DIV>&nbsp;</DIV>  <DIV>(.......which Scheme&nbsp;displays as (cons&nbsp;(cons 'X (cons 'A (cons 'T empty)))&nbsp;(cons (cons 'A (cons 'X (cons 'T empty))) (cons (cons 'A (cons 'T (cons 'X empty))) empty)))....)</DIV>  <DIV>&nbsp;</DIV>  <DIV>(2) I propose you make a second example again.&nbsp;</DIV>  <DIV>&nbsp;</DIV>  <DIV>  <DIV>;Example 2: (define (insert-in-single-word 'X (list 'Y).&nbsp; </DIV>  <DIV>Result should be (list (list 'X 'Y) (list 'Y 'X))</DIV>  <DIV>&nbsp;</DIV>  <DIV>  <DIV>(3) This is NOT a template.&nbsp;</DIV>  <DIV>&nbsp;</DIV>  <DIV>Yikes, my bad.&nbsp; Here's the
 proper template:</DIV>  <DIV>&nbsp;</DIV>  <DIV>; Template: <BR>;&nbsp;&nbsp; (define (insert-in-single-word s word)<BR>;&nbsp;&nbsp;&nbsp;&nbsp; (cond<BR>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [(empty? (rest word)) empty]<BR>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [else .....(first word)......(insert-in-single-word s (rest word)))]))</DIV>  <DIV>&nbsp;</DIV>  <DIV>(4) And before you complete the template build a table just like the one above for the recursive case.&nbsp;</DIV>  <DIV>&nbsp;</DIV>  <DIV>  <DIV>First Table: </DIV>  <DIV>&nbsp;</DIV>  <DIV>&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)</DIV>  <DIV>--------------------------------------------------------------------------------------------------------</DIV>  <DIV>&nbsp;'X &nbsp; |(list 'A 'T)|&nbsp;&nbsp;&nbsp;&nbsp; 'A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 |&nbsp;&nbsp;(insert-in-single-word&nbsp;s (list 'T)&nbsp;|&nbsp;&nbsp; (list (list 'X 'A 'T) (list 'A 'X 'T) (list 'A 'T 'X))</DIV>  <DIV>&nbsp;</DIV>  <DIV>Table for Recursive Case:</DIV>  <DIV>&nbsp;</DIV>  <DIV>  <DIV>&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)</DIV>  <DIV>--------------------------------------------------------------------------------------------------------</DIV>  <DIV>&nbsp;'X &nbsp; |(list 'T)|&nbsp;&nbsp;&nbsp;&nbsp; 'T&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;(insert-in-single-word&nbsp;s empty&nbsp;|&nbsp;&nbsp; (list (list 'X 'T) (list 'T 'X))</DIV></DIV>  <DIV>&nbsp;</DIV>  <DIV>I feel I am getting closer to the answer.&nbsp; The second table suggest to me that there is something about recurring down to 2 letters and then appending the rest on.....except that I lost the rest of the letters.&nbsp;
 </DIV>  <DIV>&nbsp;</DIV>  <DIV>The only way I can visualize it is like file cabinets, and I use a counting function to count all the letters and assigning them to little files or numbered variables and then increment the value of the input variable in between each one.&nbsp; </DIV>  <DIV>&nbsp;</DIV>  <DIV>I know that is ridiculous but that is what comes to mind.</DIV></DIV></DIV></DIV>  <DIV><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 2:12 PM, Cooke Kelsey wrote:<BR class=Apple-interchange-newline>  <BLOCKQUOTE type="cite">  <DIV>Here's the answers to your questions:</DIV>  <DIV>&nbsp;</DIV>  <DIV>Q: What do you mean with (rest ..) ? &nbsp;This doesn't look like my table.&nbsp;</DIV>  <DIV>&nbsp;</DIV>  <DIV>&nbsp;A:&nbsp;Your table says, "(insert-everywhere/in-all-words s (rest low)," which means I
 would rewrite the whole function in the column?&nbsp;</DIV></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV>I want to know what the result of&nbsp;(insert-everywhere/in-all-words s (rest low)) would be when low = ...&nbsp;</DIV>  <DIV>(Looking more closely, your second row says you did the right thing.)&nbsp;</DIV>  <DIV><BR></DIV>  <DIV><BR></DIV>  <BLOCKQUOTE type="cite">  <DIV>&nbsp;<SPAN class=Apple-style-span style="-webkit-text-stroke-width: -1">[This isn't quite right! 'AT is NOT the representation of the English word "at".]</SPAN></DIV>  <DIV>&nbsp;</DIV>  <DIV>&nbsp; A: I was trying to use shorthand from Intermezzo 2:</DIV><PRE class=schemeresponse><SPAN class=keyword>'</SPAN>(<SPAN class=variable>a</SPAN> <SPAN class=variable>b</SPAN> <SPAN class=variable>c</SPAN>)  <SPAN class=comment>This short-hand is an abbreviation for</SPAN>  (<SPAN class=builtin>list</SPAN> <SPAN class=keyword>'</SPAN><SPAN class=variable>a</SPAN> <SPAN class=keyword>'</SPAN><SPAN
 class=variable>b</SPAN> <SPAN class=keyword>'</SPAN><SPAN class=variable>c</SPAN>)  </PRE></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV>Then what is '(AT)? Hint: you used ' improperly, and that is common for beginners. I recommend you stick to (list 'a 'b 'c) and (list (list 'a) (list 't)) and so on.&nbsp;</DIV>  <DIV><BR></DIV>  <DIV><BR></DIV>  <BLOCKQUOTE type="cite">  <DIV>&nbsp;<SPAN class=Apple-style-span style="-webkit-text-stroke-width: -1">Q: Why not take one step from row 1, which uses a list with one word. What would be the next case?&nbsp;</SPAN></DIV>  <DIV>&nbsp;</DIV>  <DIV>A: Um, two words.&nbsp; I have no idea why I did that.</DIV></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV>Make up a simpler example. Simple examples are good.&nbsp;</DIV>  <DIV><BR></DIV><BR>  <BLOCKQUOTE type="cite">  <DIV><SPAN class=Apple-style-span style="-webkit-text-stroke-width: -1">Q: The second leap went wrong. Why?&nbsp;Is it possible that you JUMPED?&nbsp; Why don't you turn the above examples
 into examples for this function. And *please* do provide a contract, a purpose statement.&nbsp;</SPAN></DIV>  <DIV>&nbsp;</DIV>  <DIV>A: OK, this is where my big problem is.&nbsp; I'm not sure what you mean by JUMPED.&nbsp; Can you be more specific?&nbsp; I realize this is some kind of clue but I am too&nbsp;slow to get it.&nbsp;</DIV></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV>JUMPED means you wrote the helper function w/o contract, purpose statement, template, examples.&nbsp;</DIV>  <DIV><BR></DIV>  <DIV><BR></DIV><BR>  <BLOCKQUOTE type="cite">  <DIV></DIV>  <DIV>&nbsp;<SPAN class=Apple-style-span style="-webkit-text-stroke-width: -1">Here's a full design recipe:</SPAN></DIV>  <DIV>&nbsp;</DIV>  <DIV>; Purpose: to insert a symbol between every letter of a single word<BR>; Contract: symbol word --&gt; list of words<BR>; Example: (define (insert-in-single-word X AT).&nbsp; Result should be (XAT AXT ATX)</DIV></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV>(0) The example is _conceptually_
 correct (meaning at the information level).&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>(1) At this point it becomes critical to spell out the (list ...) stuff, i.e., to turn the example into full-fledged Scheme data. Small step.&nbsp;</DIV>  <DIV>(2) I propose you make a second example again.&nbsp;</DIV>  <DIV><BR></DIV><BR>  <BLOCKQUOTE type="cite">  <DIV>; Template: <BR>;&nbsp;&nbsp; (define (insert-in-single-word s word)<BR>;&nbsp;&nbsp;&nbsp;&nbsp; (cond<BR>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [(empty? (rest word)) empty]<BR>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [else (append (list (first word) s (rest word)) (insert-in-single-word s (rest word)))]))</DIV></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV>This is NOT a template.&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>And before you complete the template build a table just like the one above for the recursive case.&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>-- Matthias</DIV>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV><BR></DIV><BR>  <BLOCKQUOTE
 type="cite">  <DIV><BR></DIV>  <DIV>Thanks very much.<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"><BR>  <DIV>On Mar 27, 2008, at 1:20 PM, Cooke Kelsey wrote:<BR class=Apple-interchange-newline>  <BLOCKQUOTE type="cite">  <DIV>Dear Dr. Felleisen, </DIV>  <DIV>thanks so much for responding!&nbsp; Your suggestions really helped me to think about the problem.</DIV>  <DIV>&nbsp;</DIV>  <DIV>Here's a table of examples, as you suggested:</DIV>  <DIV>&nbsp;</DIV>  <DIV>;;Examples <BR>; s | low&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |(first..)|(rest..)&nbsp;&nbsp;&nbsp; | result</DIV></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV>Q: What do you mean with (rest ..) ? &nbsp;This doesn't look like my table.&nbsp;</DIV>  <DIV><BR></DIV><BR>  <BLOCKQUOTE type="cite"> 
 <DIV>;--------------------------------------------------------------------------------------------------------<BR>; X | '(AT)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |'(AT)&nbsp;&nbsp;&nbsp; |empty&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | '((XAT) (AXT) (ATX))</DIV></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV>[This isn't quite right! 'AT is NOT the representation of the English word "at".]</DIV>  <DIV><BR></DIV><BR>  <BLOCKQUOTE type="cite">  <DIV>; X | '((AB) (CD) (EF))|'(AB)&nbsp;&nbsp;&nbsp; |'((CD) (EF))| '((XAB) (AXB) (ABX) (XCD) (CXD) (CDX) (XEF) (EXF) (EFX))</DIV></BLOCKQUOTE>  <DIV><BR></DIV>This second row looks hyper-complicated.&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>Q: Why not take one step from row 1, which uses a list with one word. What would be the next case?&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>  <DIV><BR></DIV>  <DIV><BR></DIV><BR>  <BLOCKQUOTE type="cite">  <DIV><SPAN class=Apple-style-span style="-webkit-text-stroke-width:
 -1">Here's an attempt to "go from the first columns to the last":&nbsp;</SPAN></DIV>  <DIV><BR>; Definitions:<BR>(define (insert-everywhere/in-all-words s low)<BR>&nbsp; (cond<BR>&nbsp;&nbsp;&nbsp; [(empty? (rest low)) empty]<BR>&nbsp;&nbsp;&nbsp; [else (append (insert-in-single-word s (first low)) (insert-everywhere/in-all-words s (rest low)))]))</DIV></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV>Good the first leap went fine.&nbsp;</DIV>  <DIV><BR></DIV><BR>  <BLOCKQUOTE type="cite">  <DIV>&nbsp;<SPAN class=Apple-style-span style="-webkit-text-stroke-width: -1">(define (insert-in-single-word s word)</SPAN></DIV>  <DIV>&nbsp; (cond<BR>&nbsp;&nbsp;&nbsp; [(empty? (rest word)) empty]<BR>&nbsp;&nbsp;&nbsp; [else (append (list (first word) s (rest word)) (insert-in-single-word s (rest word)))]))</DIV></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV>The second leap went wrong. Why?&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>Is it possible that you JUMPED? &nbsp;Why don't you turn the above examples into
 examples for this function. And *please* do provide a contract, a purpose statement.&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>-- Matthias</DIV>  <DIV><BR></DIV>  <DIV><BR></DIV><BR>  <BLOCKQUOTE type="cite">  <DIV><BR></DIV>  <DIV>Unfortunately, the list of words gets shorter and shorter (sATX, sTX, sX).&nbsp; I tried to think of a way to add a recursive "prefix" that gets longer, but each time the function cycles the first letters seem to disappear into the void...</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"><BR>  <DIV>On Mar 25, 2008, at 1:48 PM, Cooke Kelsey wrote:   <BLOCKQUOTE type="cite">  <DIV><SPAN class=Apple-style-span style="-webkit-text-stroke-width: -1">I am trying to learn HtDP by myself, and like Dave Yrueta I am stumped by 12.4.2.&nbsp;</SPAN></DIV></BLOCKQUOTE> 
 <DIV><BR></DIV>[Oops I forgot to reply to his last message.]<BR><BR><BR>  <BLOCKQUOTE type="cite">  <DIV><SPAN class=Apple-style-span style="-webkit-text-stroke-width: -1">; Purpose: to insert a symbol between every letter of every word, e.g. X, AT--&gt;XAT, AXT, ATX.</SPAN></DIV></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV>Please reformulate the example in terms of symbols and lists.&nbsp;</DIV>  <DIV><BR></DIV><BR>  <BLOCKQUOTE type="cite">  <DIV>&nbsp;<SPAN class=Apple-style-span style="-webkit-text-stroke-width: -1">;Function Template:&nbsp;</SPAN></DIV>  <DIV>(define (insert-everywhere/in-all-words s low)<BR>&nbsp; (cond<BR>&nbsp;&nbsp;&nbsp; [(empty? (rest low))...]<BR>&nbsp;&nbsp;&nbsp; [else ...(first low)...insert-everywhere/in-all-words s (rest low)]))<BR></DIV>  <DIV>Note: </DIV>  <DIV>It is suggested to use "append", which is easy one or two times---(append x&nbsp;word) or&nbsp;(append&nbsp;(append&nbsp;(first word) x) (rest word))----but I can't see how to use this
 recursively for an arbitrary number of letters and words.&nbsp;</DIV></BLOCKQUOTE>  <DIV><BR></DIV>  <DIV>So far so good. Let's try what HtDP/2e will introduce:&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>Please make a table of the following shape:&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>&nbsp;s &nbsp; | &nbsp; low &nbsp;| &nbsp; (first low) &nbsp;| &nbsp;(insert-everywhere/in-all-words s (rest low) | expected result for (insert-... s low)</DIV>  <DIV>--------------------------------------------------------------------------------------------------------</DIV>  <DIV>&nbsp;X &nbsp; | &nbsp; AT &nbsp; | &nbsp; &nbsp; ? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | &nbsp;use the purpose statement to determine this | &nbsp; (list `XAT' `AXT' `ATX')</DIV>  <DIV><BR></DIV>  <DIV><BR></DIV>  <DIV>As I said, you need to reformulate this in terms of symbols and lists. If it doesn't jump out at you how to go from the four columns to the last one, then make a couple of more examples. I am pretty
 sure it will. Here is the rule of thumb:&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>&nbsp;--&gt; you know of a built-in function/primitive that does the work&nbsp;</DIV>  <DIV>&nbsp;--&gt; you don't. in this case, you make a wish: a purpose statement and a contract for a helper function that does it for you.&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>You may also have to combine a primitives with functions.&nbsp;</DIV>  <DIV><BR></DIV>  <DIV>Please report back -- Matthias</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 fact that the "hint" refers to the keyword list, which the book hasn't covered yet,&nbsp;makes me wonder if it's even possible to answer this problem, given what we know so far...</DIV>  <DIV>&nbsp;</DIV>  <DIV>Thanks very much, </DIV>  <DIV>&nbsp;</DIV>  <DIV>Cooke</DIV>  <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>   <DIV style="MARGIN: 0px">_________________________________________________</DIV>  <DIV style="MARGIN: 0px"><SPAN class=Apple-converted-space>&nbsp; </SPAN>For list-related administrative tasks:</DIV>  <DIV style="MARGIN: 0px"><SPAN class=Apple-converted-space>&nbsp; </SPAN><A href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</A></DIV></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>  <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><p>&#32;
      <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>