Fork me on GitHub
#clojure-spec
<
2020-05-14
>
Amir Eldor19:05:51

How do you define a map spec with keys of similar spec? e.g.:

(s/def potato-name string?)
(s/def potato-happiness number?)

;; This is a potato:
{:name "potato name"
 :happiness-1 12
 :happiness-2 54}
Similarly, I see that (s/keys) requires a fully qualified name for each key and it's strange to me. What if I got two specs with the same key but different specs?

Alex Miller (Clojure team)19:05:38

the idea behind spec is to give attributes global semantic meaning, by using namespaced attributes to differentiate and not do that