Does anybody know of a lib that allows me to inline fn specs in the fn’s metadata? Looking for something like:
(defn myfn
{:spec (...)}
...)
… which would be equivalent to:
(defn myfn ...)
(s/fdef myfn ...)I don't know of a library that does this specifically, but I think it should be doable with a macro. Perhaps something like this:
;; idea: create a macro defn+spec
(defn+spec myfn
{:spec (,,,)}
[]
,,,)
;; so that it expands to
(do
(defn myfn
{:spec (,,,)}
[]
,,,)
(s/fdef myfn (:spec (meta #'myfn))))There's https://github.com/danielcompton/defn-spec which has links to some other libs too in the README