On 21 March 2011 15:52, Jonathan Smith <jonathansmith...@gmail.com> wrote:
> Here is a way that should work.
>
> (let [missing (gensym)]
>  (defn get-with-exception [map key]
>    (let [res (get map key missing)]
>      (if (= res missing)
>          (throw (new Exception "my-exception"))
>        res))))

You may be able to speed this up a tiny bit more by using identical?
instead of =

:-)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to