Haskell How To Delete Duplicate Element In List

[Solved] Haskell How To Delete Duplicate Element In List | Haskell - Code Explorer | yomemimo.com
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

Answers related to haskell how to delete duplicate element in list

Code Explorer Popular Question For Haskell