Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Various improvements to infix:<X>.
Remove various superstitious bits of code that worked around the way
things were pre-GLR. Then make sure we .list the things we are going
to work over. It turns out that if a Range were one of the arguments
to infix:<X> then indexing it would be rather more expensive than if
we had done .list on it in the first place.
  • Loading branch information
jnthn committed Sep 14, 2015
1 parent aaa4363 commit e5c1df1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/core/List.pm
Expand Up @@ -936,19 +936,17 @@ sub infix:<X>(|lol) {
}
my int $n = lol.elems - 1;
my $Inf = False;
eager my @l = do for 0..$n -> $i {
my \elem = lol[$i]; # can't use mapping here, mustn't flatten
my @l = do for 0..$n -> $i {
my \elem = lol[$i];
$Inf = True if $i and elem.is-lazy;
nqp::istype(elem, Iterable)
?? elem.item # without this .item, a Seq would get iterated by the "for"
!! elem.list;
elem.list
}

# eagerize 2nd and subsequent lists if finite
my Mu $end := nqp::list_i();
if !$Inf {
for 1 .. $n -> $i {
nqp::bindpos_i($end,$i,@l[$i].cache.elems);
nqp::bindpos_i($end,$i,@l[$i].elems);
}
}

Expand Down

0 comments on commit e5c1df1

Please sign in to comment.