Oh I see. Thanks for the explanation. I always assumed that chunked
sequences can be viewed as purely an optimization and transparent from
the user. Is there a way (short of writing a lazy version of apply
concat) that I can achieve my desired result?
I've heard talk about trying to provide some option for zero-lookahead
lazy sequences. I don't think any API has been stabilized, though.
One workaround I've used is to use delay to avoid the execution of
individual elements, but that doesn't really work in this case: you
need to force them in order to apply concat.
Maybe something like:
(defn force-concat [& xs]
(when xs
(lazy-seq
(concat (force (first xs))
(force-concat (rest xs))))))
(def temp (for [i (range 50)]
(delay
(do (println i)
[i i i]))))
(def temp2 (apply force-concat temp))
(println (take 10 temp2))
It behaves oddly on my machine, but I think the principle is sound...
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en