Clojure spec surprising behaviour

27 Views Asked by At

I am trying to learn spec, and have come across the following behaviour.

My code:

(s/def ::foo (s/cat :first symbol?
                    :rest (s/alt :simple vector?
                                 :multi (s/cat :parts (s/* symbol?) :final vector?))))
(s/explain ::foo '(foo [blah] x))
(s/conform ::foo '(foo [blah] x))

What I find is that explain prints "Success!" while conform returns :clojure.spec.alpha/invalid. Have I stumbled on a bug, or have I not understood the functions? Or is my spec invalid in the first place? (I am using Clojure 1.11.1 & spec 0.3.218)

0

There are 0 best solutions below