Leisure
GithubIssue TrackerSponsor
  • Introduction
  • Installation
  • Changelog
  • F.A.Q.
  • API
    • Static Methods
    • Instance Methods
    • Simplex Methods
    • Combinatorial Methods
    • Random Number Generating Methods
Powered by GitBook
On this page
  • cartesianProduct
  • powerSet
  • combination

Was this helpful?

  1. API

Combinatorial Methods

PreviousSimplex MethodsNextRandom Number Generating Methods

Last updated 2 years ago

Was this helpful?

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

cartesianProduct

Generates sequence of the 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 .

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

combination

Generates sequence of Sets of a 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>>
Cartesian product
Power set
Combination