Vocabulary

math.combinatorics

Inputs

Outputs

Word description

Outputs the nth lexicographical permutation of seq.

Notes

Permutations are 0-based and a bounds error will be thrown if n is larger than seq length factorial 1 -.

Examples

Definition

math.combinatorics

Inputs

n | a non-negative integer |

seq | a sequence |

Outputs

seq' | a sequence |

Word description

Outputs the nth lexicographical permutation of seq.

Notes

Permutations are 0-based and a bounds error will be thrown if n is larger than seq length factorial 1 -.

Examples

USING: math.combinatorics prettyprint ;
1 { 0 1 2 } permutation .

{ 0 2 1 }

{ 0 2 1 }

USING: math.combinatorics prettyprint ;
5 { "apple" "banana" "orange" } permutation .

{ "orange" "banana" "apple" }

{ "orange" "banana" "apple" }

Definition

This documentation was generated offline from a
`load-all`

image. If you want, you can also
browse the documentation from within the UI developer tools. See
the Factor website
for more information.

Factor 0.100 x86.64 (2262, heads/master-127a5086a9, Feb 24 2024 11:21:44)