Hi,

Am Montag, 18. Juli 2011 16:48:05 UTC+2 schrieb bonega:
>
> Got something like this:
>
> (for [e entries]
>       {:filename (.getName e)
>        :comment (.getComment e)
>        :manymorekeys xxx})
>
> Quite often I get nil as comments. Problem is that I don't want any keys 
> added for comment if there are none.
>

You could do something like this:

(for [e entries]
  (merge {:filename (.getName e) :manymorekeys :xxx}
          (when-let [comments (.getComments e)] {:comments comments})))

Sincerely
Meikel
 

-- 
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