summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2008-02-08 21:05:08 +0000
committerRich Hickey <richhickey@gmail.com>2008-02-08 21:05:08 +0000
commitd555974a8d941986e2dec4a8e1b14a03695a9c1f (patch)
tree3d3989c2ab59b1c0543b6e82d86ee937c8d5b8c6 /src
parent16c725ff4d413909d1e5d02819ca23278c424fbb (diff)
made meta return nil on non-IObjs
Diffstat (limited to 'src')
-rw-r--r--src/boot.clj16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/boot.clj b/src/boot.clj
index 8f8d7ac7..a8d0077d 100644
--- a/src/boot.clj
+++ b/src/boot.clj
@@ -39,13 +39,6 @@
([comparator & args]
(. clojure.lang.PersistentTreeMap (create comparator args))))
-;;;;;;;;;;;;;;;;; metadata ;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defn meta [#^clojure.lang.IObj x]
- (. x (meta)))
-
-(defn with-meta [#^clojure.lang.IObj x m]
- (. x (withMeta m)))
-
;;;;;;;;;;;;;;;;;;;;
@@ -62,6 +55,15 @@
(defmacro when-not [test & body]
(list 'if test nil (cons 'do body)))
+;;;;;;;;;;;;;;;;; metadata ;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defn meta [x]
+ (when (instance? clojure.lang.IObj x)
+ (. #^clojure.lang.IObj x (meta))))
+
+(defn with-meta [#^clojure.lang.IObj x m]
+ (. x (withMeta m)))
+
+
(defn #^Boolean nil? [x] (identical? x nil))
(defn #^Boolean false? [x] (identical? x false))
(defn #^Boolean true? [x] (identical? x true))