Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix off-by-one error in general Range iterator
We always skipped the first element.
Noticed by dwarring++
  • Loading branch information
niner committed Aug 22, 2015
1 parent 769c5b3 commit bd5cfcb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/core/Range.pm
Expand Up @@ -179,8 +179,14 @@ my class Range is Cool does Iterable does Positional {
}

method pull-one() {
$!i.=succ;
$!i <= $!e ?? $!i !! IterationEnd
if $!i <= $!e {
my Mu $i = $!i;
$!i = $i.succ;
$i
}
else {
IterationEnd
}
}
}.new($value, $!excludes-max ?? $!max.pred !! $!max)
}
Expand Down

0 comments on commit bd5cfcb

Please sign in to comment.