aboutsummaryrefslogtreecommitdiff
path: root/src/clojure
diff options
context:
space:
mode:
authorStuart Sierra <mail@stuartsierra.com>2009-11-02 11:29:44 -0500
committerStuart Sierra <mail@stuartsierra.com>2009-11-02 11:29:44 -0500
commit962d8be44aa71ee13aa12a21f277f62b3c301021 (patch)
tree05def547c5c096a8f7c2c297d8e4f75a84894116 /src/clojure
parent407ab8766349881d87d48409601337b1f0dc485a (diff)
PersistentFnMap.clj: add default value arity for -valAt; fixes #41
Diffstat (limited to 'src/clojure')
-rw-r--r--src/clojure/contrib/fnmap/PersistentFnMap.clj9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/clojure/contrib/fnmap/PersistentFnMap.clj b/src/clojure/contrib/fnmap/PersistentFnMap.clj
index c340c74e..dfa3af64 100644
--- a/src/clojure/contrib/fnmap/PersistentFnMap.clj
+++ b/src/clojure/contrib/fnmap/PersistentFnMap.clj
@@ -42,9 +42,12 @@
(defn- -entryAt [this key]
(clojure.lang.MapEntry. key ((::getter (. this state)) (. this state) key)))
-
-(defn -valAt [this key]
- ((::getter (. this state)) (. this state) key))
+(defn -valAt
+ ([this key]
+ ((::getter (. this state)) (. this state) key))
+ ([this key default]
+ (or ((::getter (. this state)) (. this state) key)
+ default)))
;; Iterable