On Wed, Apr 1, 2015 at 2:17 PM, Tassilo Horn <t...@gnu.org> wrote: > Alex Miller <a...@puredanger.com> writes: > > Hi Alex, > > > - Eduction is no longer Seqable and thus the return from eduction is not > > seqable (but it is reducible and iterable). You can use iterator-seq to > get a > > chunked seq over the top if you need one. > > Really? > > user> *clojure-version* > {:major 1, :minor 7, :incremental 0, :qualifier "alpha6"} > user> (seq (eduction (map inc) (range 10))) > (1 2 3 4 5 6 7 8 9 10) >
Yep. :) user=> (supers (class (eduction (map inc) (range 10)))) #{clojure.lang.Sequential java.lang.Object java.lang.Iterable clojure.lang.IReduceInit clojure.lang.IType} However, seq checks for Iterable and will automatically use iterator-seq to produce a seq from an Iterable, which is what's happening here. See: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L517 > - There are lots of performance implications due to those changes and > > I would recommend re-testing any perf test related to sequence or > > eduction on alpha6 to get a fresh picture as anything pre-alpha6 is > > not comparable. > > My observations are all based on today's experience with alpha6. :-) > > > - eduction now takes multiple transformations, not just one, and > > composes them. This is designed for mechanical rewriting (hello tool > > developers!!) of ->> chains like this: > > > > (->> s (interpose 5) (partition-all 2)) > > > > to this: > > > > (->> s (eduction (interpose 5) (partition-all 2))) > > Ah, that's sensible. > > > The general idea is that eduction is best when the result will be > > completely consumed in a reducible context. Any case of reusing the > > result will likely be better served by sequence which can cache and > > reuse the answer. > > Yes, that's what I guessed. But at least when I tested replacing > sequence with eduction at exactly these places () the result has been a > slight slowdown instead of a speedup. But that might have been > accidental as it is hard to do measurements with real-world code where a > 5% slowdown/speedup might be the reason of something completely > unrelated. > Are you including the cost of realizing the elements? Comparing this stuff well is hard, or at least I had a hard time thinking through all the nuances. From what I've looked at, I think the alpha6 changes have made things slightly worse for sequence with transformations and somewhat better for eductions used in a reducible or sequence context. > > Bye, > Tassilo > -- 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.