Hi Sam, A nice late night exercise...
Not very practical, but if you want a safe transaction-free operation on an atom which returns whether it was changed, you can perhaps hack it by embedding the change state into the atom itself: (def a (atom {:value 45 :changed? false})) (defn update-and-check-whether-modified? [update-fn] (:changed? (swap! a (fn [{v :value _ :changed?}] (let [new-v (update-fn v)] (if (== v new-v) {:value new-v :changed? false} {:value new-v :changed? true})))))) (update-and-check-whether-modified? (fn [x] (+ x 1))) (update-and-check-whether-modified? (fn [x] 70)) -- 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