There's a few new functions that have been added with Transducers which mostly have very clear use cases to me. What are the use cases for the new eduction <http://clojure.github.io/clojure/branch-master/clojure.core-api.html#clojure.core/eduction> function? (which looks like it was previously called iteration). The example at http://clojure.org/transducers is informative. It looks similar to sequence in that it produces something that is seq-able with the major difference being that the transform is applied each time the sequence is traversed.
You can see the difference here in this code (This uses iteration instead of eduction because I was on 1.7.0-alpha2) (def to-str-iteration (iteration (map (fn [i] (println "iteration" i) (str i))) (range 3))) (def to-str-seq (sequence (map (fn [i] (println "sequence" i) (str i))) (range 3))) (println "First iteration") (dorun to-str-iteration) (println "Second iteration") (dorun to-str-iteration) (println "First sequence") (dorun to-str-seq) (println "Second sequence") (dorun to-str-seq) Printed: First iteration iteration 0 iteration 0 iteration 1 iteration 2 Second iteration iteration 0 iteration 0 iteration 1 iteration 2 First sequence sequence 0 sequence 1 sequence 2 Second sequence Should we use eduction when we need side effects or reading the current state during a transform and sequence when the transform is pure? Or is there a subtler difference between the two that I'm missing? -- 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.