[plt-scheme] Re: Word permutations - with a slight twist

From: Noel Welsh (noelwelsh at yahoo.com)
Date: Thu Jan 18 16:18:55 EST 2007

--- wooks <wookiz at hotmail.com> wrote:

> Just a little more help please.
> 
> What would the one-step permutations be for my case where
> I am given
> 
> '(aa b)
> 
> but have to generate 4 letter words. Thats a bit more
> complex than your
> example and I wish to solidify what you mean by a 1 step
> permutation.

Forget about the 4 letter restriction for now -- that's a
trivial condition to add later.

For now try to solve this:

Given two lists of symbols, one being the permutations
already generated (list A), and one being the symbols that
form the permutations (list B), generate the list of
symbols that consist of all the permutations of list B
appended to the elements of list A.

Example

(one-step-permutations '(a b c) '(x y))

=>

'(ax ay bx by cx cy)

HTH,
Noel

Email: noelwelsh <at> yahoo <dot> com   noel <at> untyped <dot> com
AIM: noelhwelsh
Blogs: http://monospaced.blogspot.com/  http://www.untyped.com/untyping/


 
____________________________________________________________________________________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/


Posted on the users mailing list.