[plt-scheme] HTDP 12.4.2

From: wooks wooks (wookiz at hotmail.com)
Date: Fri Jun 23 18:21:35 EDT 2006

The only thing I can see is that (first word) is not being used but I can't 
see where to slot it.
My best idea yet is another auxiliary function to collate all substrings of 
word that start from the beginnig of word and to merge that with the output 
I am getting below.

----Original Message Follows----
From: Matthias Felleisen <matthias at ccs.neu.edu>
To: "wooks wooks" <wookiz at hotmail.com>
CC: plt-scheme at list.cs.brown.edu
Subject: Re: [plt-scheme] HTDP 12.4.2
Date: Fri, 23 Jun 2006 15:15:08 -0400

On Jun 23, 2006, at 3:05 PM, wooks wooks wrote:

>(interperse 'f (list 'd 'a 'r 'k))
>(list (list 'f 'd 'a 'r 'k) (list 'f 'a 'r 'k) (list 'f 'r 'k) (list 'f 'k) 
>and I want
>(list (list 'f 'd 'a 'r 'k) (list 'd 'f 'a 'r 'k) (list 'd 'a 'f 'r 'k) 
>(list 'd 'a 'r 'f 'k) (list 'd 'a 'r 'k 'f))

Change the formating of the two things and take a close look:

(list (list 'f 'd 'a 'r 'k) (list 'f 'a 'r 'k)    (list 'f 'r 'k)       
(list 'f 'k)                            'f)
(list (list 'f 'd 'a 'r 'k) (list 'd 'f 'a 'r 'k) (list 'd 'a 'f 'r 'k) 
(list 'd 'a 'r 'f 'k) (list 'd 'a 'r 'k 'f))

When you recur with (rest word) you are dropping the first letter, at each 
stage.  So not surprisingly, the prefix is lost.

Try with an example of length two and see whether you can come up with a 
better idea.

Posted on the users mailing list.