Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Streamline :nth(*-1)
  • Loading branch information
lizmat committed Dec 18, 2014
1 parent 57faf7a commit f8267f2
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/core/Str.pm
Expand Up @@ -621,9 +621,7 @@ my class Str does Stringy { # declared in BOOTSTRAP
my $max = 0;
while @nlist {
my $n = shift @nlist;
if $n ~~ Callable {
$n = $n(+@src) + 1;
}
$n = $n(+@src) + 1 if nqp::istype($n, Callable);
fail "Attempt to retrieve negative match :nth($n)" if $n < 1;
if $n > $max { take @src[$n-1]; $max = $n; }
}
Expand Down

0 comments on commit f8267f2

Please sign in to comment.