Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update native_array.pm
use a shortcut for deciding IterationEnd
  • Loading branch information
grondilu committed Dec 12, 2015
1 parent 1f45b22 commit 4cf0862
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/native_array.pm
Expand Up @@ -731,8 +731,8 @@ sub permutations(int $n where $n > 0) {
# 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;
$k-- until $k < 0 or @!a[$k] < @!a[$k + 1];
return IterationEnd if $k < 0;
$k-- or return IterationEnd until @!a[$k] < @!a[$k + 1];

# Find the largest index l greater than k such that a[k] < a[l].
my int $l = @!a.end;
$l-- until @!a[$k] < @!a[$l];
Expand Down

0 comments on commit 4cf0862

Please sign in to comment.