-
Notifications
You must be signed in to change notification settings - Fork 0
/
specs.clj
28 lines (24 loc) · 1.11 KB
/
specs.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
(ns com.gfredericks.dot-slash-2.specs
(:require
[clojure.spec.alpha :as s]))
(s/def :com.gfredericks.dot-slash-2/spec
(s/map-of simple-symbol?
(s/coll-of :com.gfredericks.dot-slash-2/var-cfg)))
(defn lazy-specifies-macro?
[m]
(if (:com.gfredericks.dot-slash-2/lazy? m)
(contains? m :com.gfredericks.dot-slash-2/macro?)
true))
(s/def :com.gfredericks.dot-slash-2/var-cfg
(s/or :var-only :com.gfredericks.dot-slash-2/var
:map (s/and (s/keys :req-un [:com.gfredericks.dot-slash-2/var]
:opt-un [:com.gfredericks.dot-slash-2/dynamic?
:com.gfredericks.dot-slash-2/lazy?
:com.gfredericks.dot-slash-2/macro?
:com.gfredericks.dot-slash-2/name])
lazy-specifies-macro?)))
(s/def :com.gfredericks.dot-slash-2/var qualified-symbol?)
(s/def :com.gfredericks.dot-slash-2/dynamic? boolean?)
(s/def :com.gfredericks.dot-slash-2/lazy? boolean?)
(s/def :com.gfredericks.dot-slash-2/macro? boolean?)
(s/def :com.gfredericks.dot-slash-2/name simple-symbol?)