Skip to content

Instantly share code, notes, and snippets.

@quephird
Last active August 29, 2015 14:19
Show Gist options
  • Save quephird/c3bd60d9b5aea64997e1 to your computer and use it in GitHub Desktop.
Save quephird/c3bd60d9b5aea64997e1 to your computer and use it in GitHub Desktop.
splitWith :: (a -> Bool) -> [a] -> [[a]]
splitWith p l
| null l = []
| null xs = splitWith p $ tail xs'
| otherwise = xs : splitWith p xs' where
(xs, xs') = break p l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment