This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-18
Channels
- # aws (3)
- # beginners (18)
- # boot (3)
- # cider (47)
- # clara (54)
- # cljs-dev (62)
- # clojure (104)
- # clojure-berlin (1)
- # clojure-denver (1)
- # clojure-italy (1)
- # clojure-nl (22)
- # clojure-russia (30)
- # clojure-spec (28)
- # clojure-uk (95)
- # clojurescript (31)
- # cloverage (1)
- # cursive (1)
- # datomic (17)
- # duct (4)
- # emacs (27)
- # fulcro (36)
- # graphql (1)
- # hoplon (1)
- # jobs-discuss (1)
- # lein-figwheel (1)
- # lumo (2)
- # off-topic (44)
- # om-next (5)
- # onyx (29)
- # precept (1)
- # re-frame (8)
- # reagent (7)
- # ring (1)
- # ring-swagger (2)
- # schema (4)
- # shadow-cljs (185)
- # spacemacs (21)
- # specter (59)
- # tools-deps (7)
- # vim (15)
- # yada (1)
I want to specify that an arg should be ::foo-type
or nil
: :args (s/cat :arg1 (s/*or* ::foo-type nil?)
there’s s/or and s/alt: they’re described better here https://clojure.org/guides/spec
try s/?
yea, thanks @troglotit this works: :args (s/cat :arg1 (s/or :foo ::foo-type :nil nil?)
I did hit that issue too 🙂. Seems like they’re required to provide context while conforming or explaining, and make decision based on that
You should use s/alt in regex ops
The keywords give names to the alternatives in the case of s/conform and context for errors via s/explain
@ramblurr If you don't need to distinguish between ::foo-type
and nil
, you could just use (s/nilable ::foo-type)