-
Notifications
You must be signed in to change notification settings - Fork 43
/
util.cljc
39 lines (34 loc) · 854 Bytes
/
util.cljc
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
29
30
31
32
33
34
35
36
37
38
39
(ns fipp.util
(:refer-clojure :exclude [boolean? char? regexp?]))
;;TODO: CLJ-1719 and CLJS-1241
(defn boolean? [x]
(or (true? x) (false? x)))
#?(:cljs (defn char? [x]
false)
:clj (def char? clojure.core/char?))
;;TODO: CLJ-1720 and CLJS-1242
#?(:clj (defn regexp? [x]
(instance? java.util.regex.Pattern x))
:cljs (def regexp? cljs.core/regexp?))
(defn edn?
"Is the root of x an edn type?"
[x]
(or (nil? x)
(boolean? x)
(string? x)
(char? x)
(symbol? x)
(keyword? x)
(number? x)
(seq? x)
(vector? x)
(record? x)
(map? x)
(set? x)
(tagged-literal? x)
(var? x)
(regexp? x)))
(defn value-obj? [x]
#?(:clj (instance? clojure.lang.IObj x)
:cljs (and (satisfies? IWithMeta x)
(not (var? x))))) ;TODO: CLJS-2398