cljs.spec.alpha/def
(def k spec-form)
Source docstring:
Given a namespace-qualified keyword or resolveable symbol k, and a
spec, spec-name, predicate or regex-op makes an entry in the
registry mapping k to the spec. Use nil to remove an entry in
the registry for k.
(defmacro def
[k spec-form]
(let [k (if (symbol? k)
(let [sym (ns-qualify &env k)]
(swap! _speced_vars conj
(vary-meta sym assoc :fdef-ns (-> &env :ns :name)))
sym)
k)
form (res &env spec-form)]
(swap! registry-ref (fn [r]
(if (nil? form)
(dissoc r k)
(assoc r k form))))
`(def-impl '~k '~form ~spec-form)))