As far as I understand, a transducer is a function that transforms a reducer function before reduce
takes place. In other words, (transduce transducer reducer collection)
is equivalent to (reduce (transducer reducer) collection)
. So these two expressions
(reduce ((map inc) -) 0 [3 4 5])
(transduce (map inc) - 0 [3 4 5])
must return the same value. Right?
Wrong
(reduce ((map inc) -) 0 [3 4 5]) -15
(transduce (map inc) - 0 [3 4 5]) 15
A bug or a feature? My version of Clojure is 1.8.0
.