A watcher fn has 4 parameters: key, reference, old-state, new-state If you use old-state and new-state rather than the reference, you should not see your problem.
--Aaron On Wed, Jul 31, 2013 at 11:00 AM, Michael Drogalis <madrush...@gmail.com>wrote: > Problem: > > I have a ref representing a queue of people in line. > I add a watch to the ref to print out the contents of the queue whenever > it changes. > Naturally, and expected, the following can happen if queuing happens in > rapid succession: > > Queue: [] > <add "Mike" to queue> > <add "John" to queue> > > console: "Queue is Mike, John" > console: "Queue is Mike" > > I'd like to write a UI for this program, but I clearly can't reliably > render based on the result delivered > by the add-watch hook. What's the solution for this problem? > > -- > -- > 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 > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.