This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-01-04
Channels
- # announcements (1)
- # babashka (1)
- # beginners (84)
- # biff (22)
- # calva (9)
- # cider (8)
- # clerk (5)
- # clj-kondo (10)
- # clojure (105)
- # clojure-europe (13)
- # clojure-nl (1)
- # clojure-norway (44)
- # clojure-spec (4)
- # clojure-uk (6)
- # clojuredesign-podcast (36)
- # cursive (13)
- # datomic (24)
- # dev-tooling (8)
- # emacs (8)
- # hyperfiddle (4)
- # jobs (1)
- # leiningen (2)
- # london-clojurians (1)
- # lsp (5)
- # malli (6)
- # membrane (11)
- # nyc (1)
- # off-topic (14)
- # other-languages (8)
- # pathom (25)
- # pedestal (2)
- # re-frame (4)
- # releases (1)
- # remote-jobs (1)
- # shadow-cljs (98)
- # sql (5)
- # squint (1)
- # tools-deps (38)
- # vim (8)
- # xtdb (11)
I'm a bit rusty with spec. Is there a "trick" to get generators working across s/and
? I think I get why it must behave like this, and can think of a few ways to do this but not sure the best or if there's some built-in shortcut in the generators library. Or is it better just to keep s/keys
specs "top level" when possible?
(s/def ::x string?)
(s/def ::y keyword?)
(s/def ::a (s/keys :req [::x]))
(s/def ::b (s/keys :req [::y]))
(s/exercise ::a) ;;works
(s/exercise ::b) ;;works
(s/exercise (s/and ::a ::b)) ;;ExceptionInfo Couldn't satisfy such-that predicate after 100 tries.
✅ 1
I believe you want https://clojuredocs.org/clojure.spec.alpha/merge
yes, merge is what you want here