Skip to content

Instantly share code, notes, and snippets.

@meqif
Created May 18, 2010 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meqif/405725 to your computer and use it in GitHub Desktop.
Save meqif/405725 to your computer and use it in GitHub Desktop.
-- removes duplicate adjacent elements
uniq_adj :: (Eq a) => [a] -> [a]
uniq_adj [] = []
uniq_adj [x] = [x]
uniq_adj (x:y:z) =
if (x == y) then uniq_adj (y:z)
else x : uniq_adj (y : z)
prop_uniq_adj xs = length (uniq_adj xs) <= length xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment