next-permutation ( seq -- seq )


Vocabulary
math.combinatorics

Inputs
seqa sequence


Outputs
seqa sequence


Word description
Rearranges the elements in seq into the lexicographically next greater permutation of elements.

Notes
Performs an in-place modification of seq.

Examples
USING: math.combinatorics prettyprint ; "ABC" next-permutation .
"ACB"


Definition