[Haskell-beginners] Beginners Digest, Vol 45, Issue 35
franco00 at gmx.com
franco00 at gmx.com
Wed Mar 28 09:36:33 CEST 2012
unique :: [Integer] -> [Integer]
unique [] = []
unique (x:xs) | elem x xs = (unique . filter (/= x)) xs
| otherwise = x : unique xs
-- This is a simpler to read version (albeit inefficient?)
unique :: [Integer] -> [Integer]
unique [] = []
unique (x:xs) | elem x xs = unique xs
| otherwise = x : unique xs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120328/2ada60ea/attachment.htm>
More information about the Beginners
mailing list