Fork me on GitHub
#clojure-spec
<
2024-04-09
>
Daniel Shriki12:04:26

I have this list list of fields related with a customer:

(s/keys :req-un [:customer/gender
                   :customer/birthdate
                   :customer/height
                   :customer/weight]
          :opt-un [:customer/middle_name
                   :customer/address]))
I want to re-use the req-un / opt-un keys list for more scenarios. extracting them outside and saving those under def or s/def, and doing:
(s/def ::basic-customer
  (s/keys :req-un ::basic-customer-keys
          :opt-un ::extra-customer-keys))
returns an error: Don't know how to create ISeq from: clojure.lang.Keyword Anyone knows another way perhaps to re-use?

Alex Miller (Clojure team)12:04:52

Because this is a macro that expects a literal vector, it is not easy to pass those as data, unless you wrap in another macro to do that replacement