Define a function
rmdups :: Eq a => [a] -> [a]
that removes duplicates from a list. For example, rmdups "ababca"
should return
"abc"
. The order of the elements in the output list is not important
Here is what I have done so far: This works:
rmdups :: Eq a => [a] -> [a]
rmdups [] = []
rmdups (x:xs) = x : rmdups (filter(/= x) xs)
This does not work, what am I doing wrong:
rmdups = map head . group . sort