Fork me on GitHub
#clojure-spec
<
2017-04-24
>
hkjels12:04:35

How do I ensure that a spec never generates the same value twice?

tbaldridge13:04:06

@hkjels you mean like values in a collection are unique? And this is for the generator for a spec?

hkjels13:04:30

I can probably make a custom generator that checks for each item, but I was hoping that something exists already

hkjels13:04:23

Actually, I think I have a good solution here

tbaldridge13:04:38

@hkjels I think that exists

tbaldridge13:04:54

s/coll-of takes an optional parameter of :distinct

mobileink18:04:03

any general-purpose spec libs out there? my googling didn't find any. I'm specking routine stuff like href, uri/url, name, uuid, etc. also more complicated but widely used stuff like phone number, postal address, etc. easy enuff, but a well-maintained lib would be better.

mobileink18:04:26

more generally: lots of schema languages and schemas out there, that can be expressed in spec. i'm working on the OCF/OIC schema; another possibility is FOAF (https://en.m.wikipedia.org/wiki/FOAF_(ontology)). it would be nice to settle on conventions, e.g. spec.foo.bar for a spec implementation of schema foo.bar.