/** * Partitions the elements of this List into two Lists using the specified * function. * * @tsplus static List.Aspects partitionMap * @tsplus pipeable List partitionMap */ export function partitionMap(f: (a: A) => Either) { return (self: List): readonly [List, List] => { const left: Array = [] const right: Array = [] for (const a of self) { const e = f(a) if (e._tag === "Left") { left.push(e.left) } else { right.push(e.right) } } return [List.from(left), List.from(right)] } }