Hello!
When mapping and reducing a map, it seems arguments are passed differently
to the function that is mapped depending on whether you reduce with
r/reduce or r/fold:
(r/fold +
(r/map (fn [k v] (inc v)) {:a 4 :b 5}))
But:
(r/reduce +
(r/map (fn [[k v]] (inc v)) {:a 4 :b 5}))
The function r/mapped is the same each time, but if the return value of
r/map is further reduce with r/fold, it received 2 arguments (key and
value). However, if it is reduced with r/reduce, the fn is called with ONE
pair [k v].
Is that normal?
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.