Fork me on GitHub
#clojure-spec
<
2019-01-29
>
jkrasnay15:01:31

I’m trying to use s/keys with a vector of keys, such that I can use the same vector of keys elsewhere:

(def my-keys [:emp/id :emp/name])
(s/def ::my-spec (s/keys :req my-keys))
…but s/keys complains. Is there any way to do this?

taylor15:01:44

there are changes coming to spec to make this easier, but for now you gotta eval

mpenet15:01:57

> (eval `(s/def ::my-spec (s/keys :req ~my-keys)))

jkrasnay15:01:59

Ah, cool. Thanks.