On Mar 3, 1:04 pm, Rich Hickey <richhic...@gmail.com> wrote:
> I think it is important to embrace asynchrony and concurrency as
> Clojure does. Any Cells-for-Clojure that presumes the world is a
> single synchronous chain of events would be a misfit. The whole notion
> of a 'current step' is suspect.

I'd appreciate it if my asynchronous lazy cells got a look, as I've
given them a few revisions now. They're at 
http://github.com/onyin/lazy-agent/tree.
They don't have any global counter, but the diamond pattern is no
problem for them. As noted in an earlier thread, my def-cell macro is
not as nice as it could be, but it wouldn't be hard for someone who is
good at macros to write a quick wrapper.

The readme:

Implements two types of agent-based 'cells' for Clojure: lazy agents
and oblivious agents. These complement the auto-agents available in
Clojure Contrib. Both allow for concurrent cell updates with
respectably efficient scheduling and avoid unnecessarily repeating
cell updates.

If you deref a lazy cell, you'll see a map: {:value xxx :status
yyy}. :status may be :needs-update, :updating, :up-to-date
or :oblivious. If a cell is up-to-date or oblivious, :value gives the
value of the cell.

When a lazy agent's ancestor changes, its value changes to {:value
nil :status :needs-update} but it does not compute its new value until
it receives a message instructing it to do so. To send the update
message to a group of agents, do (update a b c d e). To send the
update message and wait for the values, do (evaluate a b c d e).

Oblivious agents are even lazier than lazy agents. When an oblivious
agent is up-to-date, its status is :oblivious. If an ancestor
subsequently changes, the oblivious agent will not do anything. It
needs to receive a 'force-need-update' message to change state to
{:value nil :status :needs-update}, but then it starts watching its
parents for changes like a lazy agent until it computes.

Anand
--~--~---------~--~----~------------~-------~--~----~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to