In case it's useful, here is a fully lazy variant of 'apply concat': https://github.com/plumatic/plumbing/blob/master/src/plumbing/core.cljx#L179
-Jason On Friday, June 3, 2016 at 2:26:43 AM UTC+8, Andy L wrote: > > Hi, > > I have a riddle I am not sure how to solve: > ``` > user=> (defn just-a-demo-seq[] (println "in just-a-demo-seq") [1 2 3 4 5 6 > 7 8 9]) > #'user/just-a-demo-seq > user=> (def do-not-print-it (apply concat (repeatedly just-a-demo-seq))) > in just-a-demo-seq > in just-a-demo-seq > in just-a-demo-seq > in just-a-demo-seq > #'user/do-not-print-it > ``` > > Question is why `just-a-demo-seq` is invoked 4 times. > > We spent some time trying to answer the question to the point of analyzing > RT.java and core.clj and pretty much ruled out `concat`. It seems that > `apply` os somewhat greedy exercising too many elements of the lazy > sequence. > > Any insight? > > Thanks, > Andy > -- 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 Note that posts from new members are moderated - please be patient with your first post. 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.