[plt-scheme] HTDP 12.4.2
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)).....]
; )
;)