/** * @tsplus getter ImmutableArray separate */ export function separate( self: ImmutableArray> ): readonly [ImmutableArray, ImmutableArray] { const left: Array = [] const right: Array = [] for (const element of self) { if (element._tag === "Left") { left.push(element.left) } else { right.push(element.right) } } return [ImmutableArray.from(left), ImmutableArray.from(right)] }