This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-22
Channels
- # beginners (20)
- # boot (5)
- # cider (14)
- # cljs-dev (15)
- # cljsrn (1)
- # clojure (81)
- # clojure-greece (7)
- # clojure-italy (17)
- # clojure-spec (5)
- # clojure-uk (15)
- # clojurescript (143)
- # data-science (1)
- # datomic (7)
- # defnpodcast (4)
- # docs (1)
- # figwheel-main (1)
- # fulcro (37)
- # graphql (1)
- # hoplon (3)
- # luminus (1)
- # reitit (5)
- # shadow-cljs (10)
- # spacemacs (5)
- # tools-deps (14)
- # vim (7)
Is it possible to define a spec with a custom generator but have it separate from the spec itself? Something like
(s/def ::my-spec (s/or :keyword keyword? :symbol symbol?))
(s/with-gen ::my-spec (gen/symbol))
Seems like it could be looking at the defn for s/with-gen
but not working at the REPL atm…You can replace spec generator impls with s/gen
's overrides
argument or via :gen
option of instrument
and check
.
A library of mine called Genman also does that well https://github.com/athos/genman If you're instested, give it a shot 😉
Works!
(gen/generate
(s/gen ::my-spec
{::my-spec gen/symbol}))