Jump to content

Next highest int from digits: Difference between revisions

m
m (→‎{{header|Factor}}: change a word)
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 thing we have to do is 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

Cookies help us deliver our services. By using our services, you agree to our use of cookies.