Changes for clojure.core/lazy-cat

rahulpilani on Wed, 13 Feb 2013
;; When the producer function produces a collection, not an element,
;; lazy-cat is usable.
user=> (defn n-repeat [n] (lazy-cat (repeat n n) (n-repeat (inc n))))
#'user/n-repeat

user=> (take 6 (n-repeat 1))
(1 2 2 3 3 3)

user=> (take 12 (n-repeat 1))
(1 2 2 3 3 3 4 4 4 4 5 5)
guruma on Fri, 14 Dec 2012
;; When the producer function produces a collection, not an element,
;; lazy-cat is usable.
user=> (defn n-repeat [n] (lazy-cat (repeat n n) (n-repeat (inc n))))
#'user/n-repeat

user=> (take 6 (j 1))
(1 2 2 3 3 3)

user=> (take 12 (j 1))
(1 2 2 3 3 3 4 4 4 4 5 5)
guruma on Fri, 14 Dec 2012
;; Given n, the producer function produces n elements of number n.
user=> (defn n-repeat [n] (lazy-cat (repeat n n) (n-repeat (inc n))))
#'user/n-repeat

user=> (take 6 (j 1))
(1 2 2 3 3 3)

user=> (take 12 (j 1))
(1 2 2 3 3 3 4 4 4 4 5 5)
guruma on Fri, 14 Dec 2012
;; Given element n, the producer function produces n elements of number n.
user=> (defn n-repeat [n] (lazy-cat (repeat n n) (n-repeat (inc n))))
#'user/n-repeat

user=> (take 6 (j 1))
(1 2 2 3 3 3)

user=> (take 12 (j 1))
(1 2 2 3 3 3 4 4 4 4 5 5)