Do list objects automatically turn lazy if they are assigned another
lazy list.  Could I make a lazy list of the natural numbers like
this:?

    @natural = 0..Inf;

Or would that end up consuming aleph-null time (neglecting issues of
finite representation)?

More interestingly, could C<grep> be used lazily?  i.e. make a (very
slow) lazy list of primes like this:?

    @primes = grep -> $n { $n % none(2..ceil(sqrt($n))) == 0 } 2..Inf;

That would be so cool!  Does it work?

Luke

Reply via email to