Skip to content

Instantly share code, notes, and snippets.

@markmarch
Created October 27, 2013 23:09
Show Gist options
  • Save markmarch/7189020 to your computer and use it in GitHub Desktop.
Save markmarch/7189020 to your computer and use it in GitHub Desktop.
splitWith
splitWith :: (a -> Bool) -> [a] -> [[a]]
splitWith f lst = case dropWhile notF lst of
[] -> []
lst' -> x : (splitWith f lst'')
where (x, lst'') = break notF lst'
where notF = not . f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment