I'm trying to represent a piece of data of the form [:some-keyword int int] where the two ints should not be equal. Is there a way to encode this relationship between the two ints in a spec? Should the spec just encode the shape of the data and leave validating this relationship to something else?
specs can be any predicate so the answer to all such questions is generally yes :)
one option is to combine a first structural spec with a second value checking one with s/and
s/and flows conformed values so that can provide structure for the second one
(s/and (s/cat :k keyword? :a int? :b int?) #(not= (:a %) (:b %))) something like that
Excellent! Thank you