Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Small programming challenge: permutations of a set

11 views
Skip to first unread message

Tom Wilcox

unread,
Dec 31, 2009, 6:50:17 PM12/31/09
to
Hi all,

Here's a simple challenge:

Can you write a Logo program that takes a word and then outputs all
permutations of its characters as a list of words? For instance, if
you give the program "123 then it would output something like [123 132
213 231 312 321]. Each item in the output should be unique, so "112
would generate a list similar to [112 121 211].

Alternately, if you know where I might find code that does this, could
you please direct me to the site?

I do have a solution in place, using Brian Harvey's higher-order
functions, such as map and reduce, but I would be very interested to
see how others solve this programming puzzle. I will exchange my
solution for yours! :-)

0 new messages