Skip to content

Instantly share code, notes, and snippets.

@pedrofurla
Created February 4, 2021 16:34
Show Gist options
  • Save pedrofurla/aaf10de8981d7279e803a9f6864c183c to your computer and use it in GitHub Desktop.
Save pedrofurla/aaf10de8981d7279e803a9f6864c183c to your computer and use it in GitHub Desktop.
foldr @[] (
\elm -> \case
(k, i):rest -> if (elm == k) then (k,i+1):rest else (elm, 1):(k, i):rest
[] -> [(elm,1)]
) [] "aaaabbbcca"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment