对由一些嵌套在?的一些<>{{cat}}}组成的spec调用<>{{conform}}}
然后调用<>{{unform}}}
将导致结果增加一个嵌套级别
(require '[clojure.spec :as s])
(let [spec (s/? (s/cat :foo #{:foo}))
initial [:foo]
conformed (s/conform spec initial)
unformed (s/unform spec conformed)]
[initial conformed unformed])
;;=> [[:foo] {:foo :foo} [(:foo)]]
只有单独使用{{?}}或{{cat}}时不会出现这种行为
(let [spec (s/? #{:foo})]
(s/unform spec (s/conform spec [:foo])))
;;=> [:foo]
(let [spec (s/cat :foo #{:foo})]
(s/unform spec (s/conform spec [:foo])))
;;=> (:foo)
*补丁:* CLJ-2003-corrected.patch