@a.map
and @a.grep
both produce lazy lists, even if @a
is not lazy.@fib.grep(* %% 2)
is a lazy list of all the even Fibonacci numbers, for instance@fib Z @a
produces a lazy list that starts @fib[0], @a[0], @fib[1], @a[1] ...
for
statement has no problem being passed an infinite list; it will loop forever unless stopped