This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-23
Channels
- # announcements (2)
- # architecture (83)
- # asami (2)
- # babashka (49)
- # bangalore-clj (2)
- # beginners (235)
- # braveandtrue (1)
- # calva (17)
- # clojure (109)
- # clojure-australia (5)
- # clojure-czech (5)
- # clojure-dev (24)
- # clojure-europe (17)
- # clojure-germany (2)
- # clojure-nl (3)
- # clojure-serbia (13)
- # clojure-spain (1)
- # clojure-spec (1)
- # clojure-uk (20)
- # clojurescript (3)
- # community-development (34)
- # conjure (10)
- # cursive (21)
- # data-science (1)
- # datahike (1)
- # datalog (1)
- # datomic (12)
- # etaoin (3)
- # events (2)
- # fulcro (13)
- # graphql (8)
- # heroku (2)
- # lsp (58)
- # malli (32)
- # membrane (24)
- # off-topic (63)
- # parinfer (2)
- # pathom (14)
- # portal (14)
- # re-frame (16)
- # reagent (50)
- # releases (1)
- # rum (1)
- # shadow-cljs (10)
- # sql (6)
- # startup-in-a-month (1)
- # timbre (2)
- # tools-deps (61)
- # xtdb (4)
Hi, I was wondering, when one has a repeating spec (e.g. non-empty string, something like a type) in spec2, what is more idiomatic: a) simply define the spec behind a keyword, e.g.
(s/def ::non-empty-string (s/and- string? (comp not str/blank?))
(s/def :foo/bar ::non-empty-string)
or b) make non-empty-string a spec op, e.g.
(s/defop non-empty-string [] (s/and- string? (comp not str/blank?)))
(s/def :foo/bar (non-empty-string))