[plt-scheme] Re: HTDP Exercise 12.4.2 ... Help!
Yes, and don't forget, you may need *more* auxiliary functions than
just insert-everywhere
On Apr 26, 2009, at 1:19 PM, S Brown wrote:
> Thanks for the input so far. I don't know how I didn't see this
> before! Instead of calling append on (list s) (first a-low), what I
> need is to call append on another function which takes as it's
> arguments a symbol and a single word, which returns a list of words
> where the symbol has been been inserted before and after each letter
> in the word. In other words, where insert-everywhere/in-all-words is
> concerned with a list of words, my new function is only concerned with
> a single word.
>
> So, now it's a matter of going through the design process for my new
> function, which I'm going to call insert-everywhere.
>
> ;; insert-everywhere: symbol word -> list-of-words
> ;; to create a list-of-words where symbol s is inserted before
> ;; and after each letter in the word w
> (define (insert-everywhere s w)
> (cond
> ((empty? w) ... s ...)
> (else ... s (first w) ...
> ... (insert-everywhere s (rest w)) ...)))
>
> I think this makes sense. Now it's a matter of completing each cond
> line in my new function insert-everywhere.. and figuring out how to
> actually insert a letter into each position of a word.
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme