While speccing a library I'm working on I tripped on a bheavior of s/unform
in combination with s/?
which I find odd:
(require '[clojure.core.specs.alpha :as cs])
(def binding-form '[a b :as c])
(def x (s/conform ::cs/seq-binding-form binding-form))
;; x => {:forms [[:local-symbol a] [:local-symbol b]], :as-form {:as :as, :as-sym c}}
(s/unform ::cs/seq-binding-form x)
;; => (a b (:as c))
(s/valid? ::cs/seq-binding-form (s/unform ::cs/seq-binding-form x))
;; => false
Is this intended behavior? On intuition, I was expecting first unforming would produce the original form and also that the result of unform would validate (using the same spec).