Skip to content

Instantly share code, notes, and snippets.

@niner
Created September 17, 2015 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niner/e82fd8f33ca4c465477c to your computer and use it in GitHub Desktop.
Save niner/e82fd8f33ca4c465477c to your computer and use it in GitHub Desktop.
diff --git a/src/core/Seq.pm b/src/core/Seq.pm
index 9abe327..a5e8fe4 100644
--- a/src/core/Seq.pm
+++ b/src/core/Seq.pm
@@ -48,10 +48,15 @@ my class Seq is Cool does Iterable does PositionalBindFailover {
method is-ready(Seq:D:) { $!iter.DEFINITE }
method iterator(Seq:D:) {
- my \iter = $!iter;
- X::Seq::Consumed.new.throw unless iter.DEFINITE;
- $!iter := Iterator;
- iter
+ if $!list.DEFINITE {
+ $!list.iterator
+ }
+ else {
+ my \iter = $!iter;
+ X::Seq::Consumed.new.throw unless iter.DEFINITE;
+ $!iter := Iterator;
+ iter
+ }
}
method is-lazy(Seq:D:) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment