Next highest int from digits: Difference between revisions

m
→‎{{header|Haskell}}: Labelled two approaches
m (→‎{{header|Haskell}}: Labelled two approaches)
Line 232:
 
=={{header|Haskell}}==
===Permutations===
Defining a list of all (if any) digit-shuffle successors of a positive integer,
in terms of permutations.
Line 286 ⟶ 287:
95322020 -> 1 of 1: [95322200]</pre>
 
===Minimal digit-swaps===
Or alternatively, definingDefining a lazily-evaluated list of all digit-shuffle successors, this time in terms of minimal digit swaps (rather than the full set of permutations).
 
(The digit-swap approach makes it feasible to obtain successors of this kind for much larger numbers)
9,659

edits