This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-26
Channels
- # announcements (7)
- # aws (1)
- # babashka (15)
- # beginners (144)
- # calva (8)
- # chlorine-clover (15)
- # clara (4)
- # clojure (65)
- # clojure-europe (131)
- # clojure-france (1)
- # clojure-nl (6)
- # clojure-nlp (3)
- # clojure-spec (10)
- # clojure-uk (52)
- # clojuredesign-podcast (2)
- # clojurescript (28)
- # cryogen (1)
- # datomic (17)
- # events (2)
- # figwheel-main (2)
- # fulcro (8)
- # hugsql (2)
- # jackdaw (4)
- # jobs (1)
- # leiningen (8)
- # lumo (1)
- # malli (4)
- # off-topic (23)
- # parinfer (3)
- # pathom (3)
- # pedestal (5)
- # re-frame (9)
- # reagent (26)
- # reitit (13)
- # reveal (25)
- # shadow-cljs (45)
- # spacemacs (7)
- # sql (7)
- # tools-deps (40)
- # vrac (2)
- # xtdb (22)
Is there a way to limit recursion depth for clojure.test.check.generators/recursive-gen
?
(require '[clojure.test.check.generators :as g])
(binding [s/*recursion-limit* 1]
(g/generate (g/recursive-gen #(g/vector % 1 2) g/boolean)))
Seeing results like:
[[[false]] [[true] [true]]]
No. It's your example result a problem?
Yes, this is a contrived example, trying to limit stack overflows with a recursive spec
I think recursive specs are generated in a different way and have their own depth control. Not 100% sure
Wrapping the collections within my component specs using recursive-gen
has made stack overflows statistically less likely than not using that wrapping. So I thought they might be helpful if they could be further controlled
Are there other depth controls beside s/*recursion-limi*t
?
no, that's it - there are a few places where they are not being properly checked I think (b/c the gen code wrongly doesn't go through the place it's checked)
that's just a suspicion right now but seems like I've seen that before
and that's only for spec generators, won't affect directly constructed test.check generators