[Haskell-cafe] Splitting list with predicate

Stephen Tetley stephen.tetley at gmail.com
Sun Mar 14 15:33:43 EDT 2010

Hi Michael

Data.List.partition - from the docs...

partition :: (a -> Bool) -> [a] -> ([a], [a])	Source

The partition function takes a predicate a list and returns the pair
of lists of elements which do and do not satisfy the predicate,
respectively; i.e.,

 partition p xs == (filter p xs, filter (not . p) xs)

More information about the Haskell-Cafe mailing list