Fork me on GitHub
#schema
<
2020-03-05
>
estevam20:03:38

Hey! I want to make a schema out of 2 enums, e.g.:

(def keys1 #{:a :b})
(def Enum1 (apply s/enum keys1))

(def keys2 #{:c :d})
(def Enum2 (apply s/enum keys2))
Could I do it like this?
(def SuperEnum (s/cond-pre Enum1 Enum2))
or is it better (in terms of performance for coercing and generating examples with clojure.spec.gen.alpha) doing like that?
(def SuperEnum (apply s/enum (clojure.set/union keys1 keys2)))