According to the docs <https://clojure.github.io/clojure/branch-master/clojure.spec-api.html#clojure.spec/keys>it's possible to use 'and' and 'or' for the required keywords. The example given is:
(s/keys :req [::x ::y (or ::secret (and ::user ::pwd))] :opt [::z]) I assume this means the conforming value has to have an ::x, a ::y, and either just ::secret or both of ::user and ::pwd. But it doesn't seem to work that way, for example: (ns mod.core (:require [clojure.spec.alpha :as s] [clojure.spec.gen.alpha :as g] [clojure.test.check]) (:gen-class)) (s/def ::example (s/keys :req [::x ::y (or ::secret (and ::user ::pwd))] :opt [::z])) (s/def ::x double?) (s/def ::y double?) (s/def ::z double?) (s/def ::secret boolean?) (s/def ::user string?) (s/def ::pwd string?) (defn -main [& args] (println (g/generate (s/gen ::example)))) generates values like: #:mod.core{:x 0.011776449391618371, :y -0.004638671875, :secret true, :user mxmoyS5x1wK322Ee, :pwd 4wqYc9t3G2ZAZ4zNNHbIHA} Is this correct/expected? I am using 1.9.0-alpha17. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.