The condition to split.
The tuple of split of the list.
{
const [left, right] = spanNot((x: number) => x > 3)(
fromArray([1, 2, 3, 4, 1, 2, 3, 4]),
);
expect(toArray(left)).toStrictEqual([1, 2, 3]);
expect(toArray(right)).toStrictEqual([4, 1, 2, 3, 4]);
}
{
const [left, right] = spanNot((x: number) => x < 9)(
fromArray([1, 2, 3]),
);
expect(toArray(left)).toStrictEqual([]);
expect(toArray(right)).toStrictEqual([1, 2, 3]);
}
{
const [left, right] = spanNot((x: number) => x > 9)(
fromArray([1, 2, 3]),
);
expect(toArray(left)).toStrictEqual([1, 2, 3]);
expect(toArray(right)).toStrictEqual([]);
}
Splits the list into a tuple of the longest prefix does NOT satisfy
predand the rest. It is equivalent tospan((item) => !pred(item)).