Range.partition
partitioncondition
Group: Selections
Documentation
Partitions the range into Vectors of elements which satisfy a given
condition and ones that do not.
Returns a Pair whose first element is the Vector of elements
satisfying the predicate and the second element is a Vector of
elements which did not satisfy it.
The relative order of elements kept in each returned list is the same as
in the input.
Arguments
condition: AFilter_Conditionor a predicate function to test each element.
Examples
Splitting a range into even and odd elements.
(0.up_to 4).partition (x-> x%2 == 0) == (Pair [0, 2] [1, 3])