How should I spec a collection that looks something like
'[data-1 1000
data-2 1]
I need to ensure the elements on the left (or in even positions) are symbols, and the elements on the right (or in odd positions) are numbers.
I tried
(s/tuple symbol? number?)
which works fine if I only have 2 elements.
Then I tried
(s/coll-of (s/tuple symbol? number?))
which expects something like
'[[data-1 1000]
[data-2 1]]^^ I was able to spec the above using
(s/def ::pair (s/cat :binding symbol? :value number?))
(s/def ::pairs (s/cat :pairs (s/* ::pair)))