Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make Seq.elems call iterator.count-only
Provide a shortcut when we want an iterator to just find out the number
of elems and nothing else (think "words".IO.lines.elems)
  • Loading branch information
lizmat committed Sep 19, 2015
1 parent 8158cb5 commit c5407d2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/Seq.pm
Expand Up @@ -77,7 +77,9 @@ my class Seq is Cool does Iterable does PositionalBindFailover {
}

method elems() {
self.cache.elems;
self.is-lazy
?? fail X::Cannot::Lazy.new(action => '.elems').new
!! self.iterator.count-only;
}

method Numeric() {
Expand Down

0 comments on commit c5407d2

Please sign in to comment.