-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Nov 30, 2008, at 10:17 AM, Luke Palmer wrote:
On Sun, Nov 30, 2008 at 9:06 AM, Jake Mcarthur <[EMAIL PROTECTED]>
wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Nov 30, 2008, at 9:03 AM, Andrew Coppin wrote:
OK, so here's something just for fun:
Given a list of items, find all possible *unique* permutations of
that
list. (E.g., the input list is explicitly _allowed_ to contain
duplicates.
The output list should not contain any duplicate permutations.)
I've found one simple way to do this, but I'm sure there are
multiple
valid approaches. So let's see what people come up with. ;-)
Seems a bit easy, I think.
Data.List.permutations . nub
That is not what he meant. Given:
[1,1,2,2]
The results should be:
[1,1,2,2]
[1,2,2,1]
[2,2,1,1]
[1,2,1,2]
[2,1,2,1]
[2,1,1,2]
Assuming I didn't miss any...
Oh, I see. Okay, I see why that would be an interesting exercise then.
Thanks for clearing that up.
- - Jake
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)
iEYEARECAAYFAkkyvlkACgkQye5hVyvIUKmMcwCgwQVbIB2IIV4yuS004K+JtGpw
b2YAoI9PihnG/R7W9Kl4884tgwPwOrYb
=MfCa
-----END PGP SIGNATURE-----
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe