Expands to code which yields a lazy sequence of the concatenation
of the supplied colls. Each coll expr is not evaluated until it is
needed.
(lazy-cat xs ys zs) === (concat (lazy-seq xs) (lazy-seq ys) (lazy-seq zs))
;; N.B. this example holds onto the head of a lazy seq which should generally be avoided(deffib-seq(lazy-cat[01](map+(restfib-seq)fib-seq)))(take10fib-seq)
;; When the producer function produces a collection, not an element,;; lazy-cat is usable.user=>(defnn-repeat[n](lazy-cat(repeatnn)(n-repeat(incn))))#'user/n-repeatuser=>(take6(n-repeat1))(122333)user=>(take12(n-repeat1))(122333444455)
user=>(defnloop-endlessly"Block thread with endless loop when evaluated"[](whiletrue))#'user/loop-endlesslyuser=>(take3(lazy-cat["will""it""return?"](loop-endlessly)))("will""it""return?")user=>(take4(lazy-cat["will""it""return?"](loop-endlessly)));; This gets stuck on loop-endlessly and never returns
;; Prefer lazy-cat to build a lazy seq out of ;; non-lazy collections with different creation costs(time(first(concat(sort>(range10))(sort>(range1e7)))));; "Elapsed time: 17442.084309 msecs"(time(first(lazy-cat(sort>(range10))(sort>(range1e7)))));; "Elapsed time: 0.458283 msecs"