Permutations: Difference between revisions
Content added Content deleted
(→{{header|C}}: simplify) |
(→{{header|Perl 6}}: missing semicolon in entity) |
||
Line 1,070: | Line 1,070: | ||
</pre> |
</pre> |
||
=={{header|Perl 6}}== |
=={{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>></tt>. |
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>></tt>. |
||
<lang perl6>sub next_perm ( @a is copy ) { |
<lang perl6>sub next_perm ( @a is copy ) { |
||
my $j = @a.end - 1; |
my $j = @a.end - 1; |