Last active 1752984559

String To List Of Words

gaiety's Avatar gaiety revised this gist 1752984559. Go to revision

1 file changed, 4 insertions

toWords.hs(file created)

@@ -0,0 +1,4 @@
1 + toWords :: String -> [String]
2 + toWords x
3 + | length x == 0 = []
4 + | otherwise = takeWhile (/= ' ') x : toWords (drop 1 (dropWhile (/= ' ') x))
Newer Older