[email protected] writes:
> Eduction retains the ability to be recomposed with other transducers
> higher in the function chain. The following two are nearly equivalent:
>
> (transduce (take 1e2) + (eduction (filter odd?) (range)))
> (transduce (comp (filter odd?) (take 1e2)) + (range))
>
> This will be slower:
> (transduce (take 1e2) + (sequence (filter odd?) (range)))
>
> Execution time mean : 19.054407 µs
> Execution time mean : 19.530890 µs
> Execution time mean : 39.955692 µs
Interesting. But in my code experimentation has shown that sequence is
almost always faster in my use-cases which usually look like
(sequence (comp (mapcat foo1)
(filter p1)
(map f1)
(mapcat foo2)
(filter p2)
(mapcat foo3)
(filter p3))
coll)
Here, I've switched between making the foo* functions return eductions
or lazy sequences, and the latter seems to alway be faster although that
looks like a use-case of eduction based on my assumptions...
So maybe eduction can unfold its full potential only during transduce?
Bye,
Tassilo
--
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
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.