import Data.List
eqPerms [] = [[]]
eqPerms xs = [x:xt | x <- nub xs, xt <- eqPerms $ delete x xs]
On 30 Nov 2008, at 18:03, 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. ;-)
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe