I'm struggling with nesting s/cat
calls.
I've got a tuple-like thing, but it's not implemented by a real vector, rather by a deftype. so I originally wrote the spec for it with s/tuple
but it failed to match. I switched to s/cat
with the parts spelled out, and that works.
but then in a (s/fdef foo :args (s/cat :x ::tuple-like :y int?))
it fails, since the cat
s end up running together.
I guess I can always write the ::tuple-like
predicate as an #(instance? TheDeftype %)
but that seems really clunky.
Try wrapping it in a s/spec
to prevent them running together: (s/cat :x (s/spec ::tuple-like) :y int?)
. Spec 1 does this with s/spec
, spec 2 will do this with https://github.com/clojure/spec-alpha2/wiki/Differences-from-spec.alpha#nested-regex-contexts.