This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-09
Channels
- # beginners (376)
- # cider (7)
- # cljs-dev (4)
- # clojure (96)
- # clojure-dev (7)
- # clojure-finland (2)
- # clojure-spec (1)
- # clojure-uk (15)
- # clojurescript (54)
- # cryogen (1)
- # defnpodcast (2)
- # docs (4)
- # emacs (1)
- # fulcro (2)
- # hoplon (15)
- # lumo (19)
- # off-topic (28)
- # om (3)
- # pedestal (2)
- # portkey (6)
- # proton (2)
- # re-frame (34)
- # reagent (4)
- # ring (3)
- # spacemacs (5)
- # unrepl (3)
I have the following
;; This ::post does not work, recursion limit
;; (spec/def ::post (spec/keys :req [::post-content ::user-id ::posts]))
;; This ::post does work, never seems to recurse though...
(spec/def ::post (spec/keys :req [::post-content ::user-id]
:opt [::posts]))
(spec/def ::posts
(spec/with-gen
(spec/map-of ::post-id ::post)
#(spec/gen (spec/map-of ::post-id ::post :min-count 0 :max-count 1))))
which defines a spec recursively; ::post
refers to ::posts
.However, if I remove :opt [::posts]
and add ::posts
to the :req
field’s ::post
, I get a Maximum call stack size exceeded
. Is this the expected behavior?