This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-23
Channels
- # beginners (81)
- # boot (1)
- # cider (1)
- # cljs-dev (15)
- # cljsrn (1)
- # clojure (27)
- # clojure-europe (9)
- # clojure-hamburg (2)
- # clojure-italy (6)
- # clojure-nl (6)
- # clojure-spec (10)
- # clojure-uk (33)
- # clojurescript (9)
- # clojurex (5)
- # cursive (14)
- # datomic (21)
- # devcards (2)
- # duct (72)
- # figwheel (1)
- # fulcro (6)
- # kaocha (3)
- # leiningen (5)
- # nrepl (10)
- # off-topic (65)
- # parinfer (12)
- # re-frame (68)
- # reagent (1)
- # reitit (14)
- # shadow-cljs (65)
- # spacemacs (6)
- # sql (4)
- # tools-deps (2)
- # yada (1)
is there a way to fspec that, say, 250+ functions all conform to the same shape? (Apologies if this is in the docs; my scanning and google-fu don’t quite know how to phrase my question quite right).
@rgm maybe something like this would work:
(s/def ::fn-spec
(s/fspec :args (s/cat :x number?)
:ret number?))
(defn foo [x] (inc x))
(defn bar [x] (dec x))
(defmacro fdef-many [syms spec]
`(do ~@(map #(list 'clojure.spec.alpha/def % spec) syms)))
(fdef-many [foo bar] ::fn-spec)
(st/instrument)
FWIW I think upcoming spec changes will make this easier