clojure-spec

About: http://clojure.org/about/spec Guide: http://clojure.org/guides/spec API: https://clojure.github.io/spec.alpha/clojure.spec.alpha-api.html
johanatan 2020-09-21T19:27:31.001200Z

hi, is there any way to override the comparator used for :distinct calculations for s/coll-of ?

johanatan 2020-09-21T19:27:55.001500Z

or is the best bet just to use s/and with a custom predicate ?

alexmiller 2020-09-21T19:40:49.001700Z

no way to do that currently

alexmiller 2020-09-21T19:41:05.002Z

but s/and custom pred would work

johanatan 2020-09-21T19:41:11.002200Z

👍

adamfrey 2020-09-21T20:46:11.003Z

is there a way to do something like :gen-max on a regex s/cat spec?

alexmiller 2020-09-21T21:10:07.003200Z

not currently

alexmiller 2020-09-21T21:11:29.004600Z

you can s/& a predicate to only accept smaller colls and that will have the same effect, but it's still producing the larger coll and that at least has memory implications (and may prevent such-that from succeeding at all)