Last active
September 1, 2018 22:19
-
-
Save lorenzo/40da377033753926e8825bdbf4fc6336 to your computer and use it in GitHub Desktop.
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 Main where | |
import qualified Data.Char | |
main = print go | |
go = | |
let l = ['a', 'b', 'a', 'A', 'b', 'B'] | |
in foldr choose [] l | |
where | |
choose ch xs | |
| null xs = [ch] | |
| Data.Char.toLower ch == Data.Char.toLower (head xs) = tail xs | |
| otherwise = ch : xs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment