对于描述spec表单的spec会很有用,这样可以从像(s/keys :req [::a ::b] :opt [::c])这样的spec表单跳转到不需要解析s表达式即可获取部分的符合版本。这可以通过创建spec来实现,从而允许
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(正在进行中)