For the complete documentation index, see llms.txt. This page is also available as Markdown.

Combinatorial Methods

These methods create sequences of the very large combinations of values.

cartesianProduct

Generates sequence of the Cartesian product of an arbitrary number of columns of data.

const sequence: Seq<[string, number]> = cartesianProduct(
  ["a", "b", "c"],
  [1, 2, 3],
)
type cartesianProduct = <T>(...inputs: T[][]) => Seq<T[]>

powerSet

Generates sequence of Sets of a Power set.

const sequence: Seq<Set<string>> = powerSet(["a", "b", "c"])
type powerSet = <T>(...items: T[]) => Seq<Set<T>>

combination

Generates sequence of Sets of a Combination of a given length.

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?