partition -package:rio

The partition function takes a predicate and 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)

Examples

>>> partition (`elem` "aeiou") "Hello World!"
("eoo","Hll Wrld!")
>>> partition even [1..10]
([2,4,6,8,10],[1,3,5,7,9])
>>> partition (< 5) [1..10]
([1,2,3,4],[5,6,7,8,9,10])
The partition function takes a predicate p and a stream xs, and returns a pair of lists. The first list corresponds to the elements of xs for which p holds; the second corresponds to the elements of xs for which p does not hold.
'partition' p xs = ('filter' p xs, 'filter' (not . p) xs)
O(n) The partition function takes a predicate a ByteString and returns the pair of ByteStrings with elements which do and do not satisfy the predicate, respectively; i.e.,
partition p bs == (filter p xs, filter (not . p) xs)
O(n) The partition function takes a predicate a ShortByteString and returns the pair of ShortByteStrings with elements which do and do not satisfy the predicate, respectively; i.e.,
partition p bs == (filter p sbs, filter (not . p) sbs)
O(n) The partition function takes a predicate and a Text, and returns the pair of Texts with elements which do and do not satisfy the predicate, respectively; i.e.
partition p t == (filter p t, filter (not . p) t)
Partition the map according to some predicate. The first map contains all elements that satisfy the predicate, the second all elements that fail the predicate. See also split.
partition (> "a") (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", singleton 5 "a")
partition (< "x") (fromList [(5,"a"), (3,"b")]) == (fromList [(3, "b"), (5, "a")], empty)
partition (> "x") (fromList [(5,"a"), (3,"b")]) == (empty, fromList [(3, "b"), (5, "a")])
partition the set according to some predicate.
Partition the map according to a predicate. The first map contains all elements that satisfy the predicate, the second all elements that fail the predicate. See also split.
partition (> "a") (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", singleton 5 "a")
partition (< "x") (fromList [(5,"a"), (3,"b")]) == (fromList [(3, "b"), (5, "a")], empty)
partition (> "x") (fromList [(5,"a"), (3,"b")]) == (empty, fromList [(3, "b"), (5, "a")])
The partition function takes a predicate p and a sequence xs and returns sequences of those elements which do and do not satisfy the predicate.
Partition the set into two sets, one with all elements that satisfy the predicate and one with all elements that don't satisfy the predicate. See also split.
Partition the map according to some predicate. The first map contains all elements that satisfy the predicate, the second all elements that fail the predicate. See also split.
partition (> "a") (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", singleton 5 "a")
partition (< "x") (fromList [(5,"a"), (3,"b")]) == (fromList [(3, "b"), (5, "a")], empty)
partition (> "x") (fromList [(5,"a"), (3,"b")]) == (empty, fromList [(3, "b"), (5, "a")])
partition the set according to some predicate.
partition of GHC 6.2.1 fails on infinite lists. But this one does not.
filter p = hoist effects (partition p)
partition takes a predicate and a sequence and returns the pair of sequences of elements which do and do not satisfy the predicate.
partition p se = (filter p se, filter (not . p) se)
The partition function takes a predicate and 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)
>>> partition (`elem` "aeiou") "Hello World!"
("eoo","Hll Wrld!")
Split the map into values that do and don't satisfy the predicate
>>> partition even (fromList [("C",3),("B",2),("A",1)])
(fromList [("B",2)],fromList [("C",3),("A",1)])

>>> partition odd (fromList [("C",3),("B",2),("A",1)])
(fromList [("C",3),("A",1)],fromList [("B",2)])
O(n). Partition the bimap according to a predicate. The first bimap contains all associations that satisfy the predicate; the second contains all associations that fail the predicate. Note that the predicate will be applied twice for each association in the bimap. Version: 0.2.4
Returns the lists that do and do not satisfy the function. Same as (filter p xs, filter (not . p) xs)
O(n) The partition function takes a predicate and a JSString, and returns the pair of JSStrings with elements which do and do not satisfy the predicate, respectively; i.e.
partition p t == (filter p t, filter (not . p) t)