From 962d8be44aa71ee13aa12a21f277f62b3c301021 Mon Sep 17 00:00:00 2001 From: Stuart Sierra Date: Mon, 2 Nov 2009 11:29:44 -0500 Subject: PersistentFnMap.clj: add default value arity for -valAt; fixes #41 --- src/clojure/contrib/fnmap/PersistentFnMap.clj | 9 ++++++--- 1 file 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 -- cgit v1.2.3-18-g5258