-
-
Save cacharle/fb0c2a14aa75375a360cb5a5a19ee182 to your computer and use it in GitHub Desktop.
split
This file contains hidden or 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 :: Eq a => a -> [a] -> [[a]] | |
split _ [] = [[]] | |
split delim str = | |
let (before, remainder) = span (/= delim) str | |
in before:case remainder of | |
[] -> [] | |
x -> split delim $ tail x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment