Last active
August 19, 2019 16:25
-
-
Save ifukazoo/0f74739f2a97d31ebe05 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