That looks about right.  I proposed adding this to clojure.contrib as
"lazy-get":

http://code.google.com/p/clojure-contrib/issues/detail?id=10

along with a corresponding "safe-get" function that errors if the key
is not found.

-Jason


On Feb 20, 4:42 pm, Rowdy Rednose <[email protected]> wrote:
> What is the easiest way to make clojure's get function evaluate the
> value for 'not-found' only if the key is not found? Do I have to write
> a macro like
>
> (defmacro my-get [map key not-found]
>   `(if (contains? ~map ~key)
>      (get ~map ~key)
>      ~not-found))
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to