all-unique-permutations ( seq -- seq' ) (original) (raw)
all-unique-permutations ( seq -- seq' )
Vocabulary
math.combinatorics
Inputs
seq | a sequence |
---|
Outputs
seq' | a sequence |
---|
Word description
Outputs a sequence containing all unique permutations of seq in lexicographical order.
Examples
USING: math.combinatorics prettyprint ; { 1 1 2 } all-unique-permutations .
{ { 1 1 2 } { 1 2 1 } { 2 1 1 } }
Definition
: all-unique-permutations ( seq -- seq' )
[ [ , ] each-unique-permutation ] { } make ;