Created
May 21, 2013 21:45
-
-
Save robinp/5623525 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
isBlank x = ' ' == x | |
f (lastBlank, res) ch = | |
if isBlank ch | |
then (True, if lastBlank then res else ' ':res) | |
else (False, ch:res) | |
g s = reverse $ snd $ foldl f (False, []) s | |
main = print $ g "x y zzz ff dd e" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment