Haskell Remove Consecutive Duplicates

[Solved] Haskell Remove Consecutive Duplicates | Haskell - Code Explorer | yomemimo.com
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

Answers related to haskell remove consecutive duplicates

Code Explorer Popular Question For Haskell