Permutations by swapping: Difference between revisions

Content added Content deleted
m (→‎header|Perl: future-proof for 5.36, explicit :prototype)
Line 2,484: Line 2,484:


===S-J-T Based===
===S-J-T Based===
<syntaxhighlight lang="perl">
<syntaxhighlight lang="perl">use strict;
#!perl
use strict;
use warnings;
use warnings;


Line 2,500: Line 2,498:
# while demonstrating some common perl idioms.
# while demonstrating some common perl idioms.


sub perms(&@) {
sub perms :prototype(&@) {
my $callback = shift;
my $callback = shift;
my @perm = map [$_, -1], @_;
my @perm = map [$_, -1], @_;