Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
minor improvement in permutations
do not create lexical scope for initial test, as suggested by timotimo
  • Loading branch information
grondilu committed Dec 8, 2015
1 parent 97ef742 commit cee77a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/native_array.pm
Expand Up @@ -717,7 +717,7 @@ sub permutations(int $n) {
submethod BUILD(:$n) { $!n = $n; self }
#method is-lazy { True }
method pull-one {
if !@!a { return (@!a = ^$!n).List }
return (@!a = ^$!n).List unless @!a;
# Find the largest index k such that a[k] < a[k + 1].
# If no such index exists, the permutation is the last permutation.
my int $k = @!a.end - 1;
Expand Down

0 comments on commit cee77a3

Please sign in to comment.