Home Manual Reference Source

Function

Static Public Summary
public

* multicombinations(n: number, r: number): IterableIterator<number[]>

Yields all k-multicombinations of {0, 1, ..., n-1}.

public

multicombinations(iterable: Iterable, r: number): IterableIterator

Yields all combinations, with repetitions, of each possible choice of r elements of the input iterable.

Static Public

public * multicombinations(n: number, r: number): IterableIterator<number[]> source

Yields all k-multicombinations of {0, 1, ..., n-1}.

Params:

NameTypeAttributeDescription
n number
r number

Return:

IterableIterator<number[]>

public multicombinations(iterable: Iterable, r: number): IterableIterator source

Yields all combinations, with repetitions, of each possible choice of r elements of the input iterable.

Params:

NameTypeAttributeDescription
iterable Iterable

The input iterable.

r number

The size of the combinations to generate.

Return:

IterableIterator

Example:

// A B C
multicombinations('ABC', 1)
// 00 01 02 11 12 22
multicombinations(range(3), 2)