Last active
June 24, 2018 17:53
-
-
Save raine/ffd6ac689a34c1bc14609733e47d98e5 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
split :: Char -> String -> (String, String) | |
split c str = (start, rest) | |
where start = takeWhile (/= c) str | |
rest = dropWhile (== c) $ dropWhile (/= c) str | |
myWords :: String -> [String] | |
myWords [] = [] | |
myWords str = start : (myWords rest) | |
where (start, rest) = split ' ' str | |
myLines :: String -> [String] | |
myLines [] = [] | |
myLines str = start : (myLines rest) | |
where (start, rest) = split '\n' str |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment