This queue is for tickets about the Algorithm-Permute CPAN distribution.

Report information
The Basics
Id:
127086
Status:
new
Priority:
Low/Low

People
Owner:
Nobody in particular
Requestors:
rkleemann [...] gmail.com
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: Original array is emptied when doing full permutations
Date: Mon, 10 Sep 2018 11:49:52 -0700
To: bug-Algorithm-Permute@rt.cpan.org
From: Bob Kleemann <rkleemann@gmail.com>
When iterating over all possible permutations, there is a strange result after the last permutation is complete:


perl -MAlgorithm::Permute -E '
my @elements = ( 1, 2, 3 );
for ( my $size = 1 ; $size <= scalar(@elements); $size++ ) {
    say "size = $size";
    my $p = Algorithm::Permute->new(\@elements, $size);
    while ( my @list = $p->next ) {
        say "[ ", join( ", ", @list ), " ]";
    }
    say scalar @elements, " = [ ", join( ", ", @elements ), " ]";
}
'

I would expect that @elements would be returned to the original content on the completion of the for loop.





This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.