@all: Thank you very much for the replies. My bottomless pit of
ignorance must be quite annoying but, I can only hope one day to be in
your position. (e.g. answering others questions)
@ataggart: A different entity is supposed to change the refs when they
go over/under some limit. It's just the way
On Feb 11, 4:22 pm, MiltondSilva wrote:
> I now have another problem. When I run this in the repl:
>
> (add-watch products :prodkey send-products)
> (add-watch material :matkey ask-material)
> (dump material products products-store)
> (loop [cnt 10]
> (map #(send % client-act) clients)
>
>(e.g. the owner should be the only one to inc materials
etc)
What's so special about the inc function as opposed to any other
function?
>Also, ask-materials and send-products should
> be call immediately after a certain threshold. ask-materials != dec,
> one decrements the other increments and
On 12 February 2010 10:22, MiltondSilva wrote:
> (add-watch products :prodkey send-products)
> (add-watch material :matkey ask-material)
> (dump material products products-store)
> (loop [cnt 10]
> (map #(send % client-act) clients)
> (map #(send % manufacture) artisans)
> (if (zero? cnt
I now have another problem. When I run this in the repl:
(add-watch products :prodkey send-products)
(add-watch material :matkey ask-material)
(dump material products products-store)
(loop [cnt 10]
(map #(send % client-act) clients)
(map #(send % manufacture) artisans)
(if (zero? cnt
I'm using counterclockwise, clojure version 1.1.0. The exception
stopped occurring I think I had to recompile the code.
I structured the code this way because of the way the problem is
formulated (e.g. the owner should be the only one to inc materials
etc), yet, the more I look at it the more it s
As Michael said, your original code works fine for me (running 1.2.0
master).
user=> (do (send artisan manufacture) (println @material @products
@products-store))
4 3 2
nil
user=> (do (send artisan manufacture) (println @material @products
@products-store))
3 0 6
nil
user=> (do (send artisan manu
This solved the problem:
(defn ask-material [a-key the-ref old-state new-state]
(if (<= new-state 0)
(dosync (alter material + (int (rand 10)
(str "asked for materials"))
When the function ask-materials is invoked, it updates the state of
the agent that caused
On 11 February 2010 02:50, MiltondSilva wrote:
> I have this code:
>
> [snip]
>
> java.lang.RuntimeException: Agent has errors (repl-1:8)
Your code works fine for me.
To help you debug your problem: you can use (agent-errors artisan) to
discover what the exception is about, clear-agent-errors to