Re: update/update-in

2009-04-29 Thread David Nolen
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 wrote: > > Thanks for the quick reply and I understand that

Re: update/update-in

2009-04-29 Thread mifrai
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 tend

Re: update/update-in

2009-04-29 Thread David Nolen
Because update-in can use any function to do the update. On Wed, Apr 29, 2009 at 6:54 PM, mifrai 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 > > > --~--~-~--~~~

update/update-in

2009-04-29 Thread mifrai
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