Combinatorial Methods
cartesianProduct
const sequence: Seq<[string, number]> = cartesianProduct(
["a", "b", "c"],
[1, 2, 3],
)type cartesianProduct = <T>(...inputs: T[][]) => Seq<T[]>powerSet
const sequence: Seq<Set<string>> = powerSet(["a", "b", "c"])type powerSet = <T>(...items: T[]) => Seq<Set<T>>combination
const sequence: Seq<Set<string>> = combination(["a", "b", "c"], 2)type combination = <T>(items: T[], size: number = items.length) => Seq<Set<T>>Last updated
Was this helpful?