On 31 Jan., 02:44, Daniel Renfer <d...@kronkltd.net> wrote: > user=> (take 0 (lazy-cat [(println 10)] [(println 20)])) > 10 > nil > > What you see here is not an issue with lazy-cat, but rather an issue > with take. The current implementation of take evaluates one more than > the n passed to it.
I don’t think so: (defn take "Returns a lazy seq of the first n items in coll, or all items if there are fewer than n." [n coll] (when (and (pos? n) (seq coll)) (lazy-cons (first coll) (when (> n 1) (take (dec n) (rest coll)))))) As we can see (pos? n) is the first thing TAKE does. As (pos? 0) ==> false the execution of take ends right here. The (seq coll) is never reached. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---