Created
April 10, 2015 16:28
-
-
Save seanhess/a488ab7ceb49b9915d0f to your computer and use it in GitHub Desktop.
Take functions that work like span, and repeatedly apply them to consume a list
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
chunks :: ([a] -> ([a], [a])) -> [a] -> [[a]] | |
chunks f [] = [] | |
chunks f xs = case c of | |
[] -> cs | |
ys -> ys : cs | |
where | |
(c, rest) = f xs | |
cs = chunks f rest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment