2008/2/8 Jed Brown <[EMAIL PROTECTED]>: > Look at Data.List: > > nub :: (Eq a) => [a] -> [a] > nub = nubBy (==) > > nubBy :: (a -> a -> Bool) -> [a] -> [a] > nubBy eq [] = [] > nubBy eq (x:xs) = x : nubBy eq (filter (\ y -> not (eq x y)) xs)
And then there's also sort :: (Ord a) => [a] -> [a] which should have better performance, O(n log n) against O(n²) I guess, but of course will change the order of the elements. If you really don't mind the order at all, you could also use Data.Set in the first place. Cheers, -- Felipe.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe