Skip to content

Instantly share code, notes, and snippets.

@benperez
Created March 8, 2016 19:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benperez/678b4e6d7e2c9001ff6e to your computer and use it in GitHub Desktop.
Save benperez/678b4e6d7e2c9001ff6e to your computer and use it in GitHub Desktop.
--dropWhereRepeated [1, 2, 2, 3, 3, 5, 7, 10]
--[1,5,7,10]
dropWhereRepeated :: (Eq a) => [a] -> [a]
dropWhereRepeated [] = []
dropWhereRepeated [x] = [x]
dropWhereRepeated (x : y : xs)
| x == y = dropWhereRepeated (dropWhile (== x) (xs))
| otherwise = x : dropWhereRepeated (y : xs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment