Skip to content

Commit

Permalink
Use .skip instead of [1..*]
Browse files Browse the repository at this point in the history
The [1..*] first caches the Seq, then creates a List out of the
given indices, and the creates a Seq out of that.  .skip just loses
one value from the Seq while returning it, so that's much more efficient.
  • Loading branch information
lizmat committed Apr 30, 2020
1 parent e0336d5 commit 4339073
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core.c/Exception.pm6
Expand Up @@ -694,7 +694,7 @@ my role X::Comp is Exception {
$r ~= "\n $_";
}
}
for @.modules.reverse[1..*] {
for @.modules.reverse.skip {
my $line = nqp::p6box_i($_<line>);
$r ~= $_<module>.defined
?? "\n from module $_<module> ($_<filename> line $line)"
Expand Down Expand Up @@ -781,7 +781,7 @@ my class X::Comp::BeginTime does X::Comp {
multi method gist(::?CLASS:D: :$sorry = True) {
my $r = $sorry ?? self.sorry_heading() !! "";
$r ~= "$.message\nat $.filename():$.line";
for @.modules.reverse[1..*] {
for @.modules.reverse.skip {
my $line = nqp::p6box_i($_<line>);
$r ~= $_<module>.defined
?? "\n from module $_<module> ($_<filename> line $line)"
Expand Down

0 comments on commit 4339073

Please sign in to comment.