A lazy enumerator defers producing elements until results are requested. This makes operations such as select usable on infinitely large collections, because evaluation stops after enough results have been produced. section 10.12
(1..Float::INFINITY).select {|n| n % 3 == 0 }.first(10)
A non-lazy select over an infinite range never finishes, so first is never reached; adding lazy creates a demand-driven chain. section 10.12
Selecting multiples of three
`(1..Float::INFINITY).lazy.select { |n| n % 3 == 0 }.first(10)` produces `[3, 6, 9, 12, 15, 18, 21, 24, 27, 30]`. Alternatively, `take` remains lazy until `force` materializes the result: `my_enum.take(5).force`. section 10.12
Lazy FizzBuzz
A lazy map over `(1..Float::INFINITY)` can calculate FizzBuzz values and use `first(n)` to return only the requested prefix, such as the first 15 values.
