Method Array.partition()
- Method partition
array(array) partition(array a, function(int(0..0), mixed ... :mixed) arbiter, mixed ... extra_args)
- Description
Splits an array in two, according to an arbitration function arbiter. The elements in a who return non-zero for the expression arbiter( a[i], @extra_args ) end up in the first sub-array, the others in the second. The order is preserved from the original array.
- Example
Array.partition( enumerate( 9 ), lambda(int n) { return n>3 && n<7; } ); > ({ ({ 4, 5, 6 }), ({ 0, 1, 2, 3, 7, 8 }) })
- See also