拥有描述规范形式的规范将非常有用,这样可以从像(s/keys :req [::a ::b] :opt [::c])这样的规范形式跳转到允许您获取而不需要解析s表达式的适当版本。这可以通过创建规范来实现,从而允许
user=> (require '[clojure.spec :as s] '[clojure.spec.specs])
user=> (s/def ::aspec (s/keys :req [::a ::b] :opt [::c]))
user=> (def aspec-data (s/conform :clojure.spec.specs/spec (s/form ::aspec)))
user=> (pr aspec-data)
[:form {:s clojure.spec/keys,
:args {:req [[:key :clojure.spec.specs/a] [:key :clojure.spec.specs/b]],
:opt [:clojure.spec.specs/c]}}]
user=> (map val (-> aspec-data val :args :req))
(:clojure.spec.specs/a :clojure.spec.specs/b)
*修复:* spec-forms.patch(进行中的工作)