Skip to content
Aleks-Daniel Jakimenko-Aleksejev edited this page Mar 11, 2017 · 16 revisions

This page is an attempt to find the true meaning of is-lazy. Eventually, this page will be moved somewhere else.

  • Rule of thumb №1: if you stick lazy in front of anything, .is-lazy will return True.
  • Rule of thumb №2: sequences are not lazy unless the endpoint is +∞ or *.
  • Rule of thumb №3: ranges are lazy if it starts with -∞ or *, or if it ends with +∞ or *.
  • Rule of thumb №4: reverse ranges ((foo..bar).reverse) are lazy if it starts or ends with -∞, or if the original range started with *.
Code .is-lazy
(1..9999999999999).is-lazy.say False
(1..∞).is-lazy.say True
(1...9999999999999).is-lazy.say False
(1...∞).is-lazy.say True
(-∞..42).is-lazy.say True
(-∞...42).is-lazy.say False
(-∞...∞).is-lazy.say True
(-∞...∞).is-lazy.say True
(0...∞).is-lazy.say True
(0...-∞).is-lazy.say False
my $s = gather for ^∞ { take $++ }; say $s.is-lazy False
lines.is-lazy.say False
().roll(*).is-lazy.say False
(1).roll(*).is-lazy.say True