ClojureDocs

Nav

Namespaces

def

  • (def k spec-form)
Given a namespace-qualified keyword or resolvable 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.
1 Example
```clojure
(ns my-app.entry 
 (:require [clojure.spec.alpha :as s]
           [clojure.repl :refer [doc]]))

;; the :: macro will automatically prepend current namespace into 
;; the qualified :entry-state spec keyword
(s/def ::entry-state #{:entered :exited})

;; check it out:
(doc :my-app.entry/entry-state)
;; -------------------------
;; :my-app.entry/entry-state
;; Spec
;;  #{:entered :exited}
```
See Also
No see-alsos for clojure.spec.alpha/def
0 Notes
No notes for def