The question is in the title. Below I copy the transducer-part of the source of map:
([f]
(fn [rf]
(fn
([] (rf))
([result] (rf result))
([result input]
(rf result (f input)))
([result input & inputs] ;why?
(rf result (apply f input inputs))))))
Here is a link to the source of clojure.core which contains the definition of map.
mapcan work on multiple collections at once, calling the mapping function with an argument for each collection item:The
+function is invoked once for each pair of values in those collections e.g.(+ 1 4),(+ 2 5),(+ 3 6). The non-transducer version looks like this.The
maptransducer works the same way: