Home Manual Reference Source

Function

Static Public Summary
public

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

Yields all permutations of each possible choice of r elements of the input iterable.

Static Private Summary
private

* _permutations(n: number, k: number): IterableIterator<IterableIterator<number>>

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

Static Public

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

Yields all permutations of each possible choice of r elements of the input iterable.

Params:

NameTypeAttributeDescription
iterable Iterable

The input iterable.

r number

The size of the permutations to generate.

Return:

IterableIterator

Example:

// AB AC AD BA BC BD CA CB CD DA DB DC
permutations('ABCD', 2) ;
// 012 021 102 120 201 210
permutations(range(3), 3) ;

Static Private

private * _permutations(n: number, k: number): IterableIterator<IterableIterator<number>> source

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

Params:

NameTypeAttributeDescription
n number
k number

Return:

IterableIterator<IterableIterator<number>>