This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-10
Channels
- # beginners (140)
- # boot (18)
- # cider (4)
- # cljs-dev (28)
- # clojure (191)
- # clojure-greece (51)
- # clojure-russia (1)
- # clojure-spec (13)
- # clojure-uk (2)
- # clojurescript (38)
- # community-development (26)
- # core-logic (16)
- # cursive (6)
- # datomic (3)
- # defnpodcast (9)
- # editors (1)
- # emacs (1)
- # fulcro (10)
- # immutant (3)
- # jobs-discuss (2)
- # leiningen (17)
- # lumo (24)
- # off-topic (30)
- # quil (12)
- # re-frame (11)
- # reagent (103)
- # remote-jobs (2)
- # shadow-cljs (157)
- # spacemacs (4)
- # unrepl (18)
- # yada (2)
I’m having trouble generating from a recursive spec, I keep hitting StackOverflowError. Are there any docs/guides on how to do that?
I’m doing:
(s/def ::a a?)
(s/def ::b b?)
(s/def ::c (s/with-gen c? (gen/fmap #(make-c %) (s/or :a ::a :b ::b :c ::c)))
hard to say because the example is missing several definitions but you could try (binding [s/*recursion-limit* 1] ...)
That helped, in that gen/sample occasionally finishes, but still stackoverflows some of the time. It surprised me that in the first 10 items, it produces nested c’s 5 deep, which I wouldn’t expect with a recursion limit of 1
yeah I think there’s been a JIRA ticket w/some discussion about this, can’t find it at the moment
@arohner also this discussion https://clojurians-log.clojureverse.org/clojure-spec/2016-08-17.html#inst-2016-08-17T19:58:22.002442Z
A transcript of a 2-hour talk by Rich Hickey from Dec 2016 about clojure.spec is up now: https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/ClojureSpec.md
It doesn't go deep into the details -- more of an intro, and big picture of ways the pieces of spec can be used.