This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-26
Channels
- # adventofcode (2)
- # beginners (69)
- # boot (37)
- # cider (6)
- # clara (31)
- # cljs-dev (75)
- # cljsrn (5)
- # clojure (72)
- # clojure-dev (7)
- # clojure-italy (11)
- # clojure-nl (8)
- # clojure-russia (2)
- # clojure-spec (56)
- # clojure-uk (54)
- # clojure-za (1)
- # clojurescript (156)
- # cursive (2)
- # datomic (34)
- # emacs (1)
- # fulcro (227)
- # hoplon (74)
- # jobs (1)
- # jobs-discuss (16)
- # leiningen (5)
- # lumo (17)
- # off-topic (9)
- # om (3)
- # onyx (10)
- # other-languages (1)
- # portkey (2)
- # re-frame (2)
- # reagent (36)
- # reitit (1)
- # remote-jobs (1)
- # ring-swagger (8)
- # shadow-cljs (85)
- # slack-help (2)
- # spacemacs (6)
- # specter (3)
- # sql (17)
- # test-check (15)
- # tools-deps (80)
What's the most idiomatic way to make a generator from a source function (like a constructor)?
(gen/fmap (fn [f] (f)) (gen/return some-constructor))
Seems oblique to say fmap "apply thyself"that example might be too simple to express your problem, because you can rewrite it as (gen/return (some-constructor))
unless the constructor is nondeterministic
is this with spec?
in general it's not idiomatic in test.check to be generating non-values, so spec exposes a bit of a mismatch here
but I suppose I've heard similar things from alex about spec
so due to all that, there's not a more idiomatic way to do what you're doing
you might even have to be careful about the same instance getting reused during shrinking
I'm 87% sure that's what would happen if you compose this with other generators
👍 this might be an interesting thing to point out in the spec channel