[Haskell-cafe] Splitting list with predicate

michael rice nowgate at yahoo.com
Sun Mar 14 15:37:58 EDT 2010


Most excellent! Thanks.

Michael

--- On Sun, 3/14/10, Stephen Tetley <stephen.tetley at gmail.com> wrote:

From: Stephen Tetley <stephen.tetley at gmail.com>
Subject: Re: [Haskell-cafe] Splitting list with predicate
To: "michael rice" <nowgate at yahoo.com>
Cc: haskell-cafe at haskell.org
Date: Sunday, March 14, 2010, 3:33 PM

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)



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100314/562a105d/attachment.html


More information about the Haskell-Cafe mailing list