我的理解是,预期 S/form
返回可以被传递给 eval
的符号列表。多规格(multi-spec)的表单不会这样行为,返回的重新标记(retag)作为评估的值(例如,一个函数实例)。
(defn retag [x v]
(assoc (vec x) 0 v))
(defmulti command first)
(s/form (s/multi-spec command retag))
=> (clojure.spec.alpha/multi-spec
current.ns/command
#object[current.ns$retag 0x708d0436 current.ns$retag@708d0436])
;; should be something like
=> (clojure.spec.alpha/multi-spec
current.ns/command
current.ns/retag)