I'm trying to define a function which will remove duplicates from a list. So far I have a working implementation:
rmdups :: Eq a => [a] -> [a]
rmdups [] = []
rmdups (x:xs) | x `elem` xs = rmdups xs
| otherwise = x : rmdups xs
However I'd like to rework this without using elem
. What would be the best method for this?
I'd like to do this using my own function and not nub
or nubBy
.