<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<br><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><br class="Apple-interchange-newline">On Apr 26, 2009, at 2:19 AM, S Brown wrote:</div><div><br></div><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">4. My header/contract and template for insert-everywhere/in-all-words:</span></div></blockquote></div><div><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">;; insert-everywhere/in-all-words: symbol list-of-words  ->  list-of-<span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">words</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">;; to create a list-of-words like a-low, but with the symbol s <span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">inserted at</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">;; the beginning, end, and in-between each letter of each word in the <span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">list-of-words in a-low</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">(define (insert-everywhere/in-all-words s a-low)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">  (cond</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">    ((empty? a-low) ... s ..)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">    (else ... s ... (first a-low) ...</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">            ... (insert-everywhere/in-all-words s (rest a-<span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">low)) ... )))</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; ">...</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Next, I looked at the first line of else, ... s ... (first a-low) ...,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">now I know that in the example above that (first a-low) becomes (list</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">'m 'e)</div></blockquote><div><br></div>Good: you've filled in the value of (first a-low) for this example, and you're (at least implicitly) comparing it with the "right answer" to the whole example.  You need to also do the same with each of the other expressions in your template: s, and (insert-everywhere/in-all-words s (rest a-low)).  The former is trivial.  For the latter, write down what (insert-everywhere/in-all-words s (rest a-low)) SHOULD be, without worrying for now about how it's actually defined (since you haven't finished writing it yet).  In most cases, the value of the recursive call will be "most" of the right answer; identify what's missing, and figure out how to fill the gap.  If there's already a function that builds what you need to fill the gap, use it; if not, write it.</div><div><br><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">, so all I need to do with the s is just add it to the</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">beginning, and I can do that using append, so I know that line can</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">become (append (list s) (first a-low)).</div></blockquote><div><br></div>This part of the sentence I don't buy: this is PART of what's missing, but not all of what's missing.</div><div><br><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">And now my brain melts and I have no idea what to do next. All I've</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">done is add the symbol to the beginning of the word, but what about</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">the rest of it? If I go to the next line, I'm just working on the next</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">word in the list-of-words, so where am I ever going to do the work</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">needed to put the symbol between the rest of the letters??? Am I even</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">on the right track with this? I don't want to continue with HTDP</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">without understanding this exercise! Can anyone help?</div></blockquote><div><br></div>Yes, you're asking exactly the right questions.  The example you chose is perhaps a little too simple: it's only 2 words, so the "rest" of it is only 1 word, which could be too simple for your human pattern-matching hardware to kick in properly, so I would start with a list of 3 words.  However, the real problem is that you started with "what can I do with (first a-low)?" rather than "what isn't taken care of by the recursive call?"</div><div><br></div><div><br></div><div>My CS1 students right now are struggling with this problem and the related problem of finding all the subsets of a given list (regardless of order), only they have to do it in Java, which is messier.</div><br><div><div>Stephen Bloch</div><div><a href="mailto:sbloch@adelphi.edu">sbloch@adelphi.edu</a></div><div><br class="webkit-block-placeholder"></div></div></div></div></body></html>