On Wed, May 6, 2009 at 12:38 AM, bOR_ wrote:
> If i remember correctly, any agents send (or send-off?) within a
> dosync are only send off after the dosync completed.
Yes, that's the kind of semantics I want, but it would be rather
clunky to have to set up an agent and fake a transformation of i
Ah. I guess the elves should be a bit more then just a number, and
perhaps be agents themselves, that come to santa with a {:toy :broken}
and leave with a {:toy :fixed}, if we want the santa problem to be bit
more applicable in reality. What is everyone assuming that the program
should do at minim
Why isn't this enough for the problem? Elves and deer are entering
Santa's frontdoor 1 at a time, when there is three elves in the room,
santa instantly deals with them (resetting the number of elves to 0),
when there is 9 deer in the room, santa goes sleighing.
(def santa (agent {:elves 0 :deer
> When writing this code, I found the watcher system a bit clunky to
> use, and a bit too heavyweight for what I needed. Sometimes, within a
> dosync block, you want to trigger some sort of side effect once the
> current transaction is committed. To make this easy, I would very
> much like to s
I think that part of the point of the Santa Claus problem is to keep
everything carefully synchronized. The Erlang and Erlang-inspired
solutions are all inherently asynchronous, which means that other
threads may be able to observe inconsistencies in state. This problem
is compounded if you
Hi,
I'm not very familiar with the concurrent features
of Clojure myself. So I can't really comment on your
solution. I tried to solve the problem myself, though.
So here is my try:
http://paste.pocoo.org/show/115929
My solution to the "prefer reindeers" problem is a
global atom *preparing*. Whi
I thought this problem (described here
http://www.cs.otago.ac.nz/staffpriv/ok/santa/)
was nifty back when I first encountered Erlang and as a learning
exercise I wanted to model something similar in Clojure. I tried to
follow the Erlang solution described in the link (http://
www.cs.otago.ac.nz/