On Sat, 20 Feb 2010 17:27:34 -0800 (PST) "sailormoo...@gmail.com" <sailormoo...@gmail.com> wrote:
> Hi : > > Say, I have a (def *a (ref {:b [{:c 5}]})) . > I want to add 1 to the :c inside, how would I write? > (Note: the value 5 is in (:b 0 :c), while 0 is the array index) > > (dosync (alter *a ______ )) ; please help me fill the blank. > > Someone mention I can use the zipper library or the walker library, > but after I checked I still have no idea how to make it. Your blank should be update-in [:b 0 :c] inc, so the whole thing is: (dosync (alter *a update-in [:b 0 :c] inc)) <mike -- Mike Meyer <m...@mired.org> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org -- 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