Re: Simple question using Agents.

2008-12-28 Thread Stephen C. Gilardi
On Dec 28, 2008, at 9:58 AM, Mark Volkmann wrote: Are you sure the code below works? It doesn't work for me with the revision 1185. For me it outputs: # 0 and stops. A change to Clojure's behavior at r1158 caused my incorrect (or at least iffy) code break instead of working. I'm guessing

Re: Simple question using Agents.

2008-12-28 Thread Mark Volkmann
Are you sure the code below works? It doesn't work for me with the revision 1185. For me it outputs: # 0 and stops. On Tue, Dec 23, 2008 at 12:18 PM, Stephen C. Gilardi wrote: > > On Dec 23, 2008, at 1:03 PM, CuppoJava wrote: > >> (send-off my_agent #( ... )) >> >> But I need the agent's state

Re: Simple question using Agents.

2008-12-23 Thread CuppoJava
Yes that's precisely what I'm looking for. When I was still writing Java code, I had the habit of importing complete packages so I didn't have to waste time individually importing the classes I needed. When it's close to release time, I would use an IDE feature to strip down the imports to the nec

Re: Simple question using Agents.

2008-12-23 Thread Stephen C. Gilardi
On Dec 23, 2008, at 5:04 PM, CuppoJava wrote: Thank you for the explanation. It's much clearer now. You're quite welcome. As an aside: do you know how to import all classes of a package in Clojure? It sounds like you're looking for something like Java's "*" in your import statement? If

Re: Simple question using Agents.

2008-12-23 Thread CuppoJava
Thank you for the explanation. It's much clearer now. As an aside: do you know how to import all classes of a package in Clojure? Again, Thanks for your help -Patrick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Simple question using Agents.

2008-12-23 Thread Stephen C. Gilardi
On Dec 23, 2008, at 3:40 PM, CuppoJava wrote: I'm a little confused about the (send-off *agent* update) line though. So as I understand it, *agent* is identical to my-agent, while running inside update. Is that correct? That is correct. Only one agent can be running on a thread at a given

Re: Simple question using Agents.

2008-12-23 Thread CuppoJava
Ahh I see. Thank you for explaining it. I'm a little confused about the (send-off *agent* update) line though. So as I understand it, *agent* is identical to my-agent, while running inside update. Is that correct? And is there any guarantee that the second send-off (send-off *agent* update) won

Re: Simple question using Agents.

2008-12-23 Thread Stephen C. Gilardi
On Dec 23, 2008, at 1:03 PM, CuppoJava wrote: (send-off my_agent #( ... )) But I need the agent's state to be updated within send-off. How do I go about doing that? The new value for the agent will be the return value from the update function. Something like: user=> (def my-agent (agent

Simple question using Agents.

2008-12-23 Thread CuppoJava
Hi, I'm learning how to use Agents and I need some help getting started with the following code. Some tips and hints would be greatly appreciated. I want to start a thread that counts upward, printing a number once every second. Here's what I have so far: The agent state will be a simple integer