Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
s/first-index(...)/first(...,:k)/
  • Loading branch information
lizmat committed Oct 17, 2015
1 parent aedaae8 commit 697cfa6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/core/Kernel.pm
Expand Up @@ -112,7 +112,7 @@ class Kernel does Systemic {

for Signal.^enum_value_list -> $signal {
my $name = substr($signal.key,3);
if @names.first-index( * eq $name ) -> $index {
if @names.first( * eq $name, :k ) -> $index {
@!signals[$index] = $signal;
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/core/Rational.pm
Expand Up @@ -152,7 +152,9 @@ my role Rational[::NuT, ::DeT] does Real {
push @quotients, $nu div $de;
}
@quotients.=map(*.base($base));
my @cycle = $nu ?? splice(@quotients, @remainders.first-index($nu) + 1) !! ();
my @cycle = $nu
?? splice(@quotients, @remainders.first($nu,:k) + 1)
!! ();
splice @quotients, 1, 0, '.';
'-' x (self < 0) ~ @quotients.join, @cycle.join;
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/Str.pm
Expand Up @@ -1378,8 +1378,8 @@ my class Str does Stringy { # declared in BOOTSTRAP
}
if $l<indent-chars> and $pos % $?TABSTOP {
my $check = $?TABSTOP - $pos % $?TABSTOP;
$check = $l<indent-chars>[0..^$check].first-index({$_.key eq "\t"});
if $check.defined {
$check = $l<indent-chars>[0..^$check].first(*.key eq "\t",:k);
with $check {
$l<indent-chars>.shift for 0..$check;
$pos -= $pos % $?TABSTOP;
$pos += $?TABSTOP;
Expand Down
8 changes: 4 additions & 4 deletions src/core/Supply.pm
Expand Up @@ -210,8 +210,8 @@ my role Supply {
my $now := now;
$target = &as(val);
my $index =
@seen.first-index({&with($target,$_[0])});
if $index.defined {
@seen.first({&with($target,$_[0])},:k);
with $index {
if $now > @seen[$index][1] { # expired
@seen[$index][1] = $now+$expires;
$res.emit(val);
Expand All @@ -225,8 +225,8 @@ my role Supply {
!! -> \val {
my $now := now;
my $index =
@seen.first-index({&with(val,$_[0])});
if $index.defined {
@seen.first({&with(val,$_[0])},:k);
with $index {
if $now > @seen[$index][1] { # expired
@seen[$index][1] = $now+$expires;
$res.emit(val);
Expand Down

0 comments on commit 697cfa6

Please sign in to comment.