On Dec 5, 6:02 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > I've added a new reference type - atom. > > Docs here: > > http://clojure.org/atoms > > Feedback welcome, > > Rich Are the following equivalent or is one recommended over the other? The first (using atoms) is definitely more convenient and less verbose. user=> (def a (ref {:a 1 :b 2 :c 3})) #'user/a user=> (def a (atom {:a 1 :b 2 :c 3})) #'user/a user=> (swap! a assoc :a 5) {:c 3, :b 2, :a 5} user=> a #<AtomicReference$IRef {:c 3, :b 2, :a 5}> OR user=> (def b (ref {:a 1 :b 2 :c 3})) #'user/b user=> (dosync (ref-set b (assoc @b :a 5))) {:c 3, :b 2, :a 5} user=> b #<Ref [EMAIL PROTECTED]> user=> @b {:c 3, :b 2, :a 5} user=> Parth --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---