My preferred method is (update-in m [:key] (fnil inc 0))
On May 31, 10:05 pm, Andreas Kostler <andreas.koestler.le...@gmail.com> wrote: > Hi all, > I find myself using the following pattern quite often: > (assoc m :key (inc (or (:kay m) 0)) > > To increment or somehow transform a value in a map that I'm not sure it > exists. > Is there an idiomatic way of doing this sort of thing in a short and concise > way? > Kind Regards > Andreas -- 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