For the sake of this question, let's assume I created the following eduction.
(def xform (map inc)) (def input [1 2 3]) (def educt (eduction xform input))
Now I want to pass
educt to some function that can then do some kind of reduction. The reason I want to pass
educt, rather than
input is that I don't want to expose
input to that function. If I did, that function could simply do a
(transduce xform f init input). But as I don't, that function is left with an eduction that cannot be used with
I know I can e.g. use
doseq on eductions, but I believe this will create a seq - with all its overhead in terms of object instantiation and usage for caching.
So how can I efficiently and idiomatically iterate over an eduction?
As eductions implement
java.lang.Iterable, this question probably generalizes to:
How to iterate over a
java.lang.Iterable without creating a seq?