[plt-scheme] HTDP 12.4.2
OOOPS I am so sorry: the last line should be
[else (????? (iE/word letter (first alow)) (iE letter (rest alow))]
-- Matthias
On Jun 22, 2006, at 2:31 PM, Matthias Felleisen wrote:
> You have changed the specs on us :-)
>
> On Jun 22, 2006, at 2:06 PM, wooks wooks wrote:
>
>>
>> At 4:43 AM +0100 6/22/06, wooks wooks wrote:
>>> LOL. Ok I've been rumbled.
>>
>> Gee, I hope not :-)
>>
>>> I'll start all over again the way I've been told and await the light
>>> bulb moment.
>>
>> "Awaiting the light bulb moment" is what you've BEEN doing; we
>> suggest instead following a systematic procedure that doesn't rely on
>> unpredictable light bulbs.
>> --
>>
>> I meant the light bulb moment as in true understanding why one should
>> stick to the systematic procedure (something more than thats how they
>> told me to do it).
>>
>> Anyway I'd appreciate some input on this revised effort (most
>> particularly my template) before going to the next stage.
>>
>> ;CONTRACT
>> ;insertEverywhere : symbol ('a - 'z) list-of-words - list of words
>> ;returns a list of words constructed by interpersing symbol before,
>> after and between each letter, of
>> ;each word in the list-of-words
>> ;
>> ;EXAMPLES
>> ;(insertEverywhere 'd
>> ; (cons (cons 'e (cons 'r empty))
>> ; (cons (cons 'r (cons 'e empty))
>> ; empty))) gives
>> ; (list (list 'd 'e 'r)
>> ; (list 'e 'd 'r)
>> ; (list 'e 'r 'd)
>> ; (list 'd 'r 'e)
>> ; (list 'r 'd 'e)
>> ; (list 'r 'e 'd))
>>
>> ;TEMPLATE
>> ;(define (insertEverywhere sym alow)
>> ; (cond
>> ; [(empty? alow) ...sym....]
>> ; [else ...sym...(first (first alow)) .....
>> ; ..sym....(rest (first alow)) .....
>> ; .....(insertEverywhere sym (rest alow)).....]
>> ; )
>> ;)
>
> Good. The rest (no pun intended) is obvious for this one:
>
> (define (iE letter alow)
> (cond [(empty? alow) empty]
> [else (??????? (iE/word letter alow) (iE letter (rest alow))]))
>
> iE/word is an entry on your wish list:
>
> ;; iE/word : letter word -> list-of-words
> ;; insert a letter at beginning, end, and between the letters of a word
>
> ????? is up to you. --- Matthias
>
>
>
>
>
>>
>>
>> _________________________________________________
>> For list-related administrative tasks:
>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme