Skip to content
Browse files

CCACHE-1: Guarding lookup with has? check

  • Loading branch information...
1 parent dbede28 commit 7f77aee164d59441caa56979821bae8f64affba7 @fogus fogus committed Nov 28, 2011
Showing with 5 additions and 5 deletions.
  1. +2 −2 src/main/clojure/clojure/core/cache.clj
  2. +3 −3 src/test/clojure/clojure/core/cache/tests.clj
View
4 src/main/clojure/clojure/core/cache.clj
@@ -43,8 +43,8 @@
(valAt [this# key#]
(lookup this# key#))
(valAt [this# key# not-found#]
- (if-let [res# (lookup this# key#)]
- res#
+ (if (has? this# key#)
+ (lookup this# key#)
not-found#))
clojure.lang.IPersistentMap
View
6 src/test/clojure/clojure/core/cache/tests.clj
@@ -34,7 +34,7 @@
(get c :e) nil
(get c :e 0) 0
(get c :b 0) 2
-;; (get c :f 0) nil
+ (get c :f 0) nil
(get-in c [:c :e]) 4
(get-in c '(:c :e)) 4
@@ -49,8 +49,8 @@
(get-in c '(:c :e) 0) 4
(get-in c [:c :x] 0) 0
(get-in c [:b] 0) 2
-;; (get-in c [:f] 0) nil
-;; (get-in c [:g] 0) false
+ (get-in c [:f] 0) nil
+ (get-in c [:g] 0) false
(get-in c [:h] 0) 0
(get-in c [:x :y] {:y 1}) {:y 1}
(get-in c [] 0) c

0 comments on commit 7f77aee

Please sign in to comment.
Something went wrong with that request. Please try again.