I am trying to understand Rich's ant colony demo. It is pretty clear
overall, except for one aspect: the use of

     (when running
       (send-off *agent* ...))

in all the functions executed by the agents, where ... stands for the
function itself. My guess is that this simply sends another request
for the same action, making for an infinite simulation. However, I
would like to understand how this works in detail.

1) What exactly is *agent*? It looks like a reference to the agent in
which the function is executing, but how does this work exactly? I
didn't find any explanation in the explanation of agents on the
Clojure Web site.

2) What is the point of (when running ...) considering that running is
set to true initially and then never changes? Is this just a way to
stop the simulation by running (def running false) from the command
prompt?

3) What is the exact difference between send and send-off? The manual
says the latter is for "potentially blocking functions", but what does
that mean and what is done differently in that case?

(send-off Konrad understand-clojure)


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to