Also, on a related note, lazy-cat always evaluates its first argument:
user> (do (lazy-cat (do (prn "1") (list 1)) nil) nil)
"1"
nil
user> (do (lazy-cons (do (prn "1") (list 1)) nil) nil)
nil
which is confusing given its documentation:
user> (doc lazy-cat)
-
clojure.core
Hi,
I noticed that while map produces a fully lazy result, mapcat always
evaluates the first three terms when it is called, and is lazy
thereafter. This can be confusing, and is sometimes not desired
behavior. For example, I'm trying to generate a lazy infinite seq
corresponding to a tree trave