Next highest int from digits: Difference between revisions

m
→‎{{header|Factor}}: English is harder than code sometimes
m (→‎{{header|Factor}}: English is harder than code sometimes)
Line 60:
 
=={{header|Factor}}==
This uses the <code>next-permutation</code> word from the <code>math.combinatorics</code> vocabulary. <code>next-permutation</code> wraps around and returns the smallest lexicographic permutation after the largest one, so the only thingadditionally we have to do ismust check if we're at the largest permutation and return zero if so. See the implementation of <code>next-permutation</code> [https://docs.factorcode.org/content/word-next-permutation%2Cmath.combinatorics.html here].
{{works with|Factor|0.99 2020-01-23}}
<lang factor>USING: formatting grouping kernel math math.combinatorics
1,827

edits