Fork me on GitHub
#clojure-spec
<
2018-05-25
>
PB16:05:31

Hey all, I'm seeing something I didn't expect. Could anyone explain this?

(distinct (remove coll?(gen/sample (s/gen any?) 1000)))
=> (nil)
Why are there no numbers, strings, ... etc?

Alex Miller (Clojure team)16:05:59

b/c any? doesn’t have a very good generator right now

Alex Miller (Clojure team)16:05:02

there is a ticket for this

PB16:05:15

Thanks Alex

jplaza17:05:22

Hi all! I’m getting an assert exception when using and, or or any combination of both inside (s/keys)

jplaza17:05:19

(s/def ::invoice :req-un [::sequence ::uuid ::properties (or ::live ::environment)]) is this a bug?

jplaza17:05:06

This is the exception I get:

Assert failed: all keys must be namespace-qualified keywords

nenadalm17:05:28

@jplaza were in the code are your s/keys? I don't see that.

jplaza17:05:10

Sorry, a typo while simplifying my code. This is the correct snippet

(s/def ::invoice (s/keys :req-un [::sequence ::uuid ::properties (or ::live ::environment)]))

nenadalm17:05:47

I don't think you tried to run the code above...

jplaza17:05:02

You are right that simple example is working.

jplaza17:05:36

But my actual code isn’t. It works if I remove the and and ors though

jplaza17:05:58

Found the error, I was stupidly trying to use or in :opt-un vector :face_palm:

🙂 4