The implementation of transducers in ClojureScript tracked an old counterpart in the Clojure codebase. This patch addresses the change introduced in the following commit to Clojure, which replaced `LazyTransformer` with `TransformerIterator`, effectively making the transducer behavior akin to the one in Clojure.
Example: a transducer that appends :foo to the result of the reduction:
(defn xf [] (fn [rf] (fn ([] (rf)) ([result] (rf result :foo)) ([result input] (rf result input))))) (sequence (xf) [1 2 3])
In Clojure, the above code yields
'(1 2 3 :foo)
. In ClojureScript, it results in an infinite loop. The same happens with `eduction`.
However,
(into [] (xf) [1 2 3])
doesn't produce an error.