Hi all,
   I have a newbie question about Agents.  I've been looking at the ants.clj
file:
http://clojure.googlegroups.com/web/ants.clj?hl=en&gda=-X7f3joAAABoLitVpBTEcNIQc_NHg39SZujXwZ5jF2pV4ArMqQ0G0e9OU0NQiFWgQuhmPR7veGf97daDQaep90o7AOpSKHW0
Most of it makes sense to me, but the use of Agents is confusing.  For
example, the line:
(send-off animator animation)
associates the "animator" Agent with the "animation" function, which I
follow.  But then the animation function looks like:
(defn animation [x]
  (when running
    (send-off *agent* #'animation))
  (. panel (repaint))
  (. Thread (sleep animation-sleep-ms))
  nil)

That third line has me lost - I don't know what *agent* is.  In Common Lisp,
that would indicate a global variable, but no such variable is declared (two
other functions, "evaporation" and "behave" have a similar call, and are the
only other references to *agent* in the file).  I'm guessing it's some sort
of reference to the agent associated with the current Action, but where is
that documented?  Secondly, why does the function immediately send off to
another agent?  Is this in order to "loop" the function (that is, keep
spawning an Action to update the agent)?  If that is the case, is the
Thread.sleep call in order to hold a reference to the agent so that the next
Action doesn't start immediately?
   Thanks for your time helping a newb; I'm pretty excited about Clojure,
and can't wait to get my hands dirty with it.
-Matt

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