Question : haskell how to delete duplicate element in list
Answered by : talented-tarsier-7uub0cahd0jd
rmdups :: (Ord a) => [a] -> [a]
rmdups l = map (head ( group ( sort l)))
-- first you sort the list, then you group all elements that are equal and then you take the first element of each list
Source : | Last Update : Thu, 27 Jan 22