{{:pred}} 应在类似以下 explain 问题中被解析:
{{s/coll-of}} 和 {{s/every-kv}} 在其值无效时,应解析 {{:pred}} 函数
(::s/problems (s/explain-data (s/coll-of (fn [x] (pos? x))) [-1]))
({:path [], :pred (fn [x] (pos? x)), :val -1, :via [], :in [0]})
应该是:
(::s/problems (s/explain-data (s/coll-of (fn [x] (pos? x))) [-1]))
({:path [], :pred (clojure.core/fn [x] (clojure.core/pos? x)), :val -1, :via [], :in [0]})
其他示例
;; every 的相同情况
(::s/problems (s/explain-data (s/every (fn [x] (pos? x))) [-1]))
({:path [], :pred (fn [x] (pos? x)), :val -1, :via [], :in [0]})
;; :distinct 选项中的 pred 没有解析
(::s/problems (s/explain-data (s/coll-of pos? :distinct true) [-1 -1]))
[{:path [], :pred distinct?, :val [-1 -1], :via [], :in []}]
map-of 和 every-kv 没有这个问题。:count、:min-count、:max-count 和 :kind 选项能够正确生成已解析的 :pred
*补丁:* clj-2168.patch