Hi Benny, On Dec 3, 9:21 pm, Benny Tsai <benny.t...@gmail.com> wrote: > Hi Nils, > > A while back, I also took a stab* at implementing Erlang-style actors in > Clojure, along with solutions for a few classic concurrency problems > (Dining Philosophers, Sleeping Barber). I was blown away by how easy it > was to implement actor semantics on top of agents. looks good. Somewhat different approach where the state of the agent is handled more explicitly. I tried to stay close to Erlang, so the state is wrapped in a closire which acts as my matching function. It might also be interesting to solve some of those classic concurrency problems the Clojure way and compare to the actor solutions.
> > Comparing our respective efforts, I see a lot of room for improvement in > mine :) I like how your actors send messages containing the address of the > recipient, which seems truer to the actor model. Also, you raise a great Actually, I do not include the address of the recipient into the message. The message is simply a symbol and then dispatched in a case statement. The example might be slightly confusing since the actors are named :ping and :pong and send messages "ping" and "pong" to each other. It's really a very simple sketch ... no pattern matching on messages and no mailboxes. > point regarding pattern matching; I think that can greatly simplify the > message handlers in my code. Looks like it's time for me to get acquainted > with core.match :) This seems to be the right approach to fake Erlang-style message handlers. > > Thanks for the food for thought! > > *https://github.com/bitsai/clojure-actors > -- 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en