Skip to content

Commit

Permalink
Don't handle 1-element lists differently with cross
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Jan 4, 2020
1 parent 737dd1b commit 87de5ee
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/core.c/Rakudo/Iterator.pm6
Expand Up @@ -1082,19 +1082,9 @@ class Rakudo::Iterator {
}
method CrossIterables(@iterables) {
nqp::if(
nqp::isgt_i((my int $n = @iterables.elems),1), # reifies

# actually need to do some crossing (probably)
nqp::isgt_i(@iterables.elems,0), # reifies
CrossIterables.new(@iterables),

# simpler cases
nqp::if(
nqp::iseq_i($n,0),
# nothing to cross, so return an empty list
Rakudo::Iterator.Empty,
# only 1 list to cross, which is the list itself
nqp::atpos(nqp::getattr(@iterables,List,'$!reified'),0).iterator
)
Rakudo::Iterator.Empty
)
}

Expand Down Expand Up @@ -4019,9 +4009,9 @@ class Rakudo::Iterator {
}
method ZipIterables(@iterables) {
nqp::if(
nqp::isgt_i((my int $n = @iterables.elems),0), # reifies
nqp::isgt_i(@iterables.elems,0), # reifies
ZipIterables.new(@iterables),
Rakudo::Iterator.Empty,
Rakudo::Iterator.Empty
)
}

Expand Down

0 comments on commit 87de5ee

Please sign in to comment.