2024年Clojure调查!中分享您的想法。

欢迎!有关如何工作的更多信息,请参阅关于页面。

0
集合
已关闭

很简单。就是这样

> clojure.walk/walk:
(outer (reduce (fn [r x] (conj r (inner x))) form form))
=> (outer (into form (map inner) form))
(outer (into (empty form) (map inner form)))
=> (outer (into (empty form) (map inner) form))
> clojure.walk/keywordize-keys:
(postwalk (fn [x] (if (map? x) (into {} (map f x)) x)) m)
=> (postwalk (fn [x] (if (map? x) (into {} (map f) x) x)) m)
> clojure.walk/strigify-keys:
(postwalk (fn [x] (if (map? x) (into {} (map f x)) x)) m)
=> (postwalk (fn [x] (if (map? x) (into {} (map f) x) x)) m)
我认为这应该被替换为`reduce-kv`中的`keywordize-keys`和`stringify-keys`

    (let [f (fn [[k v]] (if (string? k) [(keyword k) v] [k v]))]
      ;; 只适用于映射
      (postwalk (fn [x] (if (map? x) (into {} (map f x)) x)) m))
...