/**
* Separate elements based on a predicate.
*
* @tsplus static List.Aspects partition
* @tsplus pipeable List partition
*/
export function partition(f: Predicate) {
return (self: List): readonly [List, List] => {
const left: Array = []
const right: Array = []
for (const a of self) {
if (f(a)) {
right.push(a)
} else {
left.push(a)
}
}
return [List.from(left), List.from(right)]
}
}