This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-03
Channels
- # announcements (1)
- # asami (13)
- # babashka (14)
- # beginners (58)
- # calva (49)
- # cljs-dev (6)
- # clojure (99)
- # clojure-europe (28)
- # clojure-gamedev (4)
- # clojure-nl (19)
- # clojure-spec (4)
- # clojure-uk (39)
- # clojured (5)
- # clojurescript (39)
- # code-reviews (3)
- # conjure (4)
- # cryogen (12)
- # cursive (21)
- # data-science (4)
- # datalog (1)
- # datomic (16)
- # duct (4)
- # events (1)
- # fulcro (6)
- # graalvm (1)
- # graphql (1)
- # jobs (13)
- # jobs-discuss (23)
- # kaocha (2)
- # lsp (15)
- # malli (24)
- # missionary (6)
- # off-topic (21)
- # polylith (75)
- # releases (2)
- # remote-jobs (4)
- # shadow-cljs (47)
- # sql (35)
- # vim (10)
- # xtdb (4)
I'm struggling with nesting s/cat
calls.
I've got a tuple-like thing, but it's not implemented by a real vector, rather by a deftype. so I originally wrote the spec for it with s/tuple
but it failed to match. I switched to s/cat
with the parts spelled out, and that works.
but then in a (s/fdef foo :args (s/cat :x ::tuple-like :y int?))
it fails, since the cat
s end up running together.
I guess I can always write the ::tuple-like
predicate as an #(instance? TheDeftype %)
but that seems really clunky.
Try wrapping it in a s/spec
to prevent them running together: (s/cat :x (s/spec ::tuple-like) :y int?)
. Spec 1 does this with s/spec
, spec 2 will do this with https://github.com/clojure/spec-alpha2/wiki/Differences-from-spec.alpha#nested-regex-contexts.