how does eduction work with stateful transducers? for example, the below prints [0 1 2] three times. wouldn't take be "used up" the first time? when is the xform "copied"/duplicated?
(let [e (eduction (take 3) (range 10))]
(prn (vec e))
(prn (vec e))
(prn (vec e)))a transducing context must transform its internal 'step/proc' fresh. can't use a possibly already transformed step/proc because it would behave unpredictably. eduction uses transduce, which freshly transform the proc every time:
...
([xform f init coll]
(let [f (xform f) ;; in your example ((take 3) conj)ah there it is, thank you. i forgot about that part of the transducer flow
i forgot that transducers are HOFs closing over the reducing function, so the ones that take inputs (like take) are 2x HOFs, closing over first the arg, and then over the reducing function, returning the "actual" transducer at the bottom
complicated heh
also why transducers that are stateful must create their state inside the application of a single transformation, not prior
jinx