~ 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=>
期望:如果形式无效,解释数据不应该是 nil