Fork me on GitHub
#clojure-spec
<
2016-07-11
>
alexmiller02:07:49

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

robert-stuttaford06:07:42

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

robert-stuttaford06:07:04

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

mandragoran08:07:54

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

robert-stuttaford09:07:49

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

alexmiller12:07:38

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

alexmiller12:07:30

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

alexmiller13: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

semperos17:07:20

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

semperos19:07:22

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

arohner20:07:42

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

arohner20:07:01

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

arohner21:07:12

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

arohner21:07:54

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

alexmiller22:07:37

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