Skip to content

Instantly share code, notes, and snippets.

@nathansobo
Created February 15, 2009 07:40
Show Gist options
  • Save nathansobo/64641 to your computer and use it in GitHub Desktop.
Save nathansobo/64641 to your computer and use it in GitHub Desktop.
splitWith :: (a -> Bool) -> [a] -> [[a]]
splitWith p x = case dropWhile (not . p) x of
[] -> []
nonEmpty -> pref : splitWith p suf
where (pref, suf) = span p nonEmpty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment