Here's my solution to your problem. Let me know if it helps.
```
user> (defn if-attr [-key obj missing]
(if-let [ret (get obj -key)] ret (assoc obj -key missing)))
#'user/if-attr
user> (if-attr :abc {} "missing-value")
{:abc "missing-value"}
user> (if-attr :abc {:abc 123} "missing-value")
123
user>
```
25.05.2013, 22:29, "atkaaz" <
atk...@gmail.com>:
> О©╫yep that was interesting thanks btw; it was a function that was acting like a macro, how odd
>
> О©╫On Sat, May 25, 2013 at 4:26 PM, Jim - FooBar(); <
jimpi...@gmail.com> wrote:
>>> О©╫so maybe a let + gensym would be in order?
>> О©╫yes that is what you do to avoid double-evaluation...:) I was making a different point though, the fact that definline produces a first class fn which still expands like a macro.
>>
>> О©╫Jim
>>
>> О©╫--
>> О©╫--
>> О©╫You received this message because you are subscribed to the Google
>> О©╫Groups "Clojure" group.
>> О©╫To post to this group, send email to
clo...@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+u...@googlegroups.com
>> О©╫For more options, visit this group at
>> О©╫
http://groups.google.com/group/clojure?hl=en
>> О©╫--- You received this message because you are subscribed to the Google Groups "Clojure" group.
>> О©╫To unsubscribe from this group and stop receiving emails from it, send an email to
clojure+u...@googlegroups.com.
>> О©╫For more options, visit
https://groups.google.com/groups/opt_out.
> О©╫--
> О©╫--
> О©╫You received this message because you are subscribed to the Google
> О©╫Groups "Clojure" group.
> О©╫To post to this group, send email to
clo...@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+u...@googlegroups.com
> О©╫For more options, visit this group at
> О©╫
http://groups.google.com/group/clojure?hl=en
> О©╫---
> О©╫You received this message because you are subscribed to the Google Groups "Clojure" group.
> О©╫To unsubscribe from this group and stop receiving emails from it, send an email to
clojure+u...@googlegroups.com.
> О©╫For more options, visit
https://groups.google.com/groups/opt_out.