Permutations: Difference between revisions

→‎{{header|Perl 6}}: explain use of "after"
(→‎{{header|Perl 6}}: borrow simplified code from dinesman)
(→‎{{header|Perl 6}}: explain use of "after")
Line 1,046:
</pre>
=={{header|Perl 6}}==
This is generic code that works with any ordered type. To force lexicographic ordering, change <tt>after</tt> to <tt>gt</tt>. To force numeric order, replace it with <tt>&gt</tt>.
<lang perl6>sub next_perm ( @a is copy ) {
my $j = @a.end - 1;
Anonymous user