Fork me on GitHub
Alex Miller (Clojure team)02:07:49

There is s/double-in with infinity and nan support


forgive the repost, folks, but i'm a little stumped 🙂


how do i specify that an optional set of keys must either appear together or not at all?


@robert-stuttaford: you can write your own predicate (-> (s/keys :opt [...]) (s/and #(every (partial contains? %) [...]))


true, thank you. i wonder if it's a use-case that has been considered by Rich et al?

Alex Miller (Clojure team)12:07:38

Have you looked at the and/or support in s/keys :req?

Alex Miller (Clojure team)12:07:30

was thinking something like (s/def ::combined (s/keys :req [(or (and ::a ::b) (and ::a ::b ::c ::d))]))

Alex Miller (Clojure team)13:07:18

however b/c of open maps, I don’t think the latter two will fail as expected - for that you probably need and an additional pred


I wonder if there’s a place for an s/xor within the clojure.spec space where one, and only one, of the provided specs may conform, or if this can be concisely expressed with a combination of the existing features


Alex or others, would appreciate your thoughts if/when you have time ^^


Here’s a fun one. If I start up a repl and clojure.test/run-tests, everything is fine. If I lein test, I get java.lang.Exception: :clojure.spec/unknown is not a fn, expected predicate fn


AFAIK, I’m not doing anything weird. Everything is required in the proper order, not using load, etc


Also AFAIK, I’m not referring to any spec that hasn’t been required


more weirdness: I run my tests from a repl, everything is fine. I run c.spec.tests/instrument, run the same tests, and I get No implementation of method: :conform* of protocol: #'clojure.spec/Spec found for class: clojure.spec$spec_impl$reify__13372. Reload all my source namespaces, everything works again

Alex Miller (Clojure team)22:07:37

I have seen some stuff like this with mixture of aot and non aot on classpath