~ clj
Clojure 1.9.0
user=> (require '[clojure.spec.alpha :as s])
nil
user=> (require '[clojure.core.specs.alpha])
nil
(let [spec (:args (s/get-spec `defn))
form `(~'foo ([~'a] 1) [~'a ~'b])]
{:valid (s/valid?
spec
form)
:explain-data (s/explain-data
spec
form)})
{:valid false, :explain-data nil}
user=>
预期:如果形式无效,explain-data不应该为nil