In `clojure.core.reducers`, `map`
<https://github.com/clojure/clojure/blob/clojure-1.8.0/src/clj/clojure/core/reducers.clj#L161-L169>
is implemented as:
(defcurried map
"Applies f to every value in the reduction of coll. Foldable."
{:added "1.5"}
[f coll]
(folder coll
(fn [f1]
(rfn [f1 k]
([ret k v]
(f1 ret (f k v)))))))
I don't understand the purpose of `rfn`, and there are others confused
about it as well <http://disq.us/p/8xfcyj>.
>From what I can see, `rfn` takes a reducing function `f1` and returns a
reducing function with 3 arities. For example, macroexpanding
(rfn [f1 k]
([ret k v]
(f1 ret (f k v))))
gives
(fn
([] (f1))
([ret v] (f1 ret (f v)))
([ret k v] (f1 ret (f k v))))
When is the 3-arity form used? An example would be helpful.
--
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/d/optout.