core.reducers
ライブラリの先頭または末尾を作成しようとしていますが、次のコード行に遭遇しましたr/map
:
(defmacro ^:private defcurried
"Builds another arity of the fn that returns a fn awaiting the last
param"
[name doc meta args & body]
(do-curried name doc meta args body))
(defn- do-rfn [f1 k fkv]
`(fn
([] (~f1))
~(clojure.walk/postwalk
#(if (sequential? %)
((if (vector? %) vec identity)
(core/remove #{k} %))
%)
fkv)
~fkv))
(defmacro ^:private rfn
"Builds 3-arity reducing fn given names of wrapped fn and key, and k/v impl."
[[f1 k] fkv]
(do-rfn f1 k fkv))
(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]
;; the following is k/v implementation but
([ret k v] ;; why a `vector` is placed in the beginning of a list???
(f1 ret (f k v)))))))
defcurried map
実装では、がリストの先頭にあるrfn
理由がわからないため、私には奇妙で珍しいように見えます。[ret k v]
誰でも説明できますか?