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.

Revisions

  1. markmarch created this gist Oct 27, 2013.
    6 changes: 6 additions & 0 deletions ch04.hs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    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