Skip to content

Instantly share code, notes, and snippets.

@hergaiety
Last active April 19, 2017 21:25
Show Gist options
  • Save hergaiety/3030c129b3ce3ce5e889601fc3009491 to your computer and use it in GitHub Desktop.
Save hergaiety/3030c129b3ce3ce5e889601fc3009491 to your computer and use it in GitHub Desktop.
String To List Of Words
toWords :: String -> [String]
toWords x
| length x == 0 = []
| otherwise = takeWhile (/= ' ') x : toWords (drop 1 (dropWhile (/= ' ') x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment