> What still riddles me is why the above > script with the first formula (with the deref problem) doesn't always > cause a problem, but maybe one in every 5 times I run it.
Sometimes it manages to queue up all the send functions before the exception is thrown, but sometimes the exception is thrown before subsequent sends which report the error. This is because putting things on the send queue is independent of the thread pool processing the queue. Consider in this case we see the exception when calling send a second time: user=> (def a (agent 1)) #'user/a user=> (send a reduce) #<Agent clojure.lang.ag...@109fd93> user=> (send a reduce) java.lang.RuntimeException: Agent has errors (NO_SOURCE_FILE:0) But when the sends are sent immediately after each other, the exception has not occurred yet: user=> (def a (agent 1)) #'user/a user=> (do (send a reduce) (send a reduce)) #<Agent clojure.lang.ag...@142a80d> However if we check later, we see that now the exception has indeed occured: user=> (agent-errors a) (#<IllegalArgumentException java.lang.IllegalArgumentException: Wrong number of args passed to: core$reduce> #<IllegalArgumentException java.lang.IllegalArgumentException: Wrong number of args passed to: core$reduce>) --~--~---------~--~----~------------~-------~--~----~ 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 clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---