clojure-spec

About: http://clojure.org/about/spec Guide: http://clojure.org/guides/spec API: https://clojure.github.io/spec.alpha/clojure.spec.alpha-api.html
Amir Eldor 2020-05-14T19:08:51.407900Z

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?

alexmiller 2020-05-14T19:49:38.408700Z

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