I see what you mean, does seem like a useful addition: (defn update [m k f & args] (assoc m k (apply f (k m) args)))
(update {:foo 0} :foo inc) vs. (assoc {:foo 0} :foo (inc (:foo {:foo 0}))) On Wed, Apr 29, 2009 at 7:13 PM, mifrai <fraim...@gmail.com> wrote: > > Thanks for the quick reply and I understand that's the functionality > of it. > > But just like get-in is the recursive form of get - I'm just wondering > why there's no singular form of update-in. > > I know it's not much more work to go (update-in map [:single-key] conj > 3) - but from experience there tends be really good reasons behind > these kinds of decisions and I'm just curious. > > On Apr 29, 4:05 pm, David Nolen <dnolen.li...@gmail.com> wrote: > > Because update-in can use any function to do the update. > > > > On Wed, Apr 29, 2009 at 6:54 PM, mifrai <fraim...@gmail.com> wrote: > > > > > Hi, > > > > > I was wondering why there was no "update" to "update-in"? But there is > > > an "assoc" to "assoc-in" and a "get" to a "get-in". > > > > > - Mike > > > --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---