Question : haskell remove consecutive duplicates
Answered by : 68duck
remdups :: [Int] -> [Int]
remdups [] = []
remdups [x] = [x]
remdups (x1:x2:xs)
| x1==x2 = remdups (x2:xs)
| otherwise = x1:remdups (x2:xs)
Source : https://cs.tellustheanswer.com/remove-consecutive-duplicates-from-a-list-in-haskell/ | Last Update : Sat, 23 Jul 22