When I run (println (iterate inc 0)) in my replica, I will get something like this:
user=> (println (iterate inc 0)) (0 1 2 3 4 5 6 7 8 9 10 11 12 13 ....................
My expectation when I run the code is that repl shows nothing and just gets stuck because (iterate inc 0) never ends. But I see (0 1 2 3 ...
(iterate inc 0) generates an infinite sequence that never returns. If this never ends, then why does println start printing values?
In other words, why (println xx) gets evaluated, even if the input never ends, is it evaluated?
source share