Hi, Am 15.06.2010 um 23:27 schrieb Ryan Waters:
> Thank you for pointing that out. I notice your style is similar to > Rich's in his ant.clj [1] which seems like the kind of solution that > might be used in other functional and/or lisp languages. Do you know > if that's the case with self-calling functions and agents? However, > isn't there more overhead with calls to send-off instead of recur? Yes, there is additional overhead. However hijacking a thread from agent thread pool (even if send-off) is misusing agents as Christophe said. Agents is about updating states. Not about (long running) threads. The typical solution for your problem would probably be: (->> long-running-function-with-recur Thread. .start) This starts you function in a dedicated thread and you can save the overhead of send-off and use recur directly. I'm unsure about using future here. For me future is a thing, which returns something. Using it for a process which does return something useful seems "dirty" to me. > I understand functions sent to an agent will only run one at a time, > fifo-style, but was under the impression *agent* was for the current > "main" thread of the program. Does *agent* instead refer to whatever > is the current thread in the function's runtime context? Hope that > question makes sense. *agent* is bound to the agent whose action we are currently running in this thread. So concurrently running actions see different *agent*s. Hope this helps. Sincerely Meikel -- 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