Created
September 1, 2011 10:26
-
-
Save beastaugh/1185896 to your computer and use it in GitHub Desktop.
Drop consecutive elements of a list if they're the same, e.g. "AAABBACDDD" => "ABACD"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Data.List.DropConsec | |
( dropConsec | |
) where | |
import Data.List (dropWhile) | |
dropConsec :: Eq a => [a] -> [a] | |
dropConsec [] = [] | |
dropConsec (x:xs) = x : dropConsec (dropWhile (== x) xs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment