This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-18
Channels
- # ai (1)
- # beginners (71)
- # boot (15)
- # cider (26)
- # clara (4)
- # cljs-dev (81)
- # cljsrn (26)
- # clojure (393)
- # clojure-berlin (2)
- # clojure-dev (5)
- # clojure-dusseldorf (1)
- # clojure-greece (5)
- # clojure-italy (6)
- # clojure-russia (97)
- # clojure-serbia (11)
- # clojure-sg (2)
- # clojure-spec (14)
- # clojure-uk (66)
- # clojurescript (58)
- # core-async (19)
- # cursive (18)
- # data-science (2)
- # datomic (75)
- # emacs (20)
- # events (5)
- # figwheel (1)
- # graphql (2)
- # hoplon (29)
- # jobs-discuss (3)
- # juxt (6)
- # lein-figwheel (1)
- # london-clojurians (2)
- # lumo (29)
- # mount (9)
- # off-topic (4)
- # om (16)
- # onyx (25)
- # other-languages (2)
- # pedestal (38)
- # protorepl (2)
- # re-frame (20)
- # reagent (9)
- # ring-swagger (6)
- # sql (10)
- # unrepl (3)
- # untangled (19)
- # utah-clojurians (1)
- # videos (2)
- # vim (20)
@gphilipp I'd think macro is doable, if you really need to have several BTs. However I'd start with (s/or ...)
with all the variants you want in it, and see if that's enough
Hello, I'm trying to use the overrides
argument on a generator, but I'm not sure how I supposed to use it
I'm trying like this:
(s/exercise
(s/keys :req [:some/data
:some/more-data])
5
{:some/data #(gen'/for [i (s/gen (s/int-in 1 1000000))]
(-> i bigdec (/ 100.0M) (* -1)))})
but that doesn't work, does someone have an example on how to use it?
that looks roughly correct, maybe share more of the example?
@alexmiller a more complete example here:
sorry the noise now, I was looking at the wrong number, A is always even here, saying it's correct, I'll check my other example again
@alexmiller ok, I think I might have found a bug
it works fine when the spec is not defined in terms of other spec
here is an example where the override doesn't work
(s/def ::common-etc int?)
(s/def ::a ::common-etc)
(s/def ::b int?)
(s/exercise (s/keys :req [::a ::b])
30
{::a #(gen/fmap (fn [x] (* x 2)) (s/gen int?))})
if ::a
was defined as int?
it works, but when making it reference other spec, the override version is not used
Oh, yes there is a ticket for this