Once you are talking about some cross-key predicate you wish to satisfy you are talking about another property of the map itself. So, you can use composition to provide further constraints on the map:
(s/and (s/keys …) cross-cutting-pred) keys is not going to be the place for that kind of cross-cutting logic, although it does have support for some keyset-membership logic (and/or in the :req set). multi-specs are more for when you have an open set of possibilities. s/or is to multi-spec as c.c.cond is to multimethods, closed vs open dispatch. > On May 24, 2016, at 7:37 PM, Stan Dyck <stan.d...@gmail.com> wrote: > > I appreciate the wisdom of separating the existence of a key from the > conformance of the values of that key. > > I wonder though if there is a way to specify co-constraints; a situation > where the conformance of the value of one key depends on the existence of and > perhaps the value of another key. > > Say for example, I want to specify a ::content-type key and a ::body key. If > the ::content-type key exists and has a value of "image/png" I want to make > sure the ::body key also exists and satisfies my image? predicate. > > It looks like multi-specs get me to the neighborhood of a solution here but > I'm not sure they quite cover it. > > > Thanks, > > StanD. > > > -- > 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. -- 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.