[cells-devel] Re: [PyCells] Chat Shocker!

Ken Tilton kentilton at gmail.com
Tue Jun 13 18:32:40 UTC 2006


On 6/13/06, Phillip J. Eby <pje at telecommunity.com> wrote:
>
> At 12:22 PM 6/13/2006 -0400, Ken Tilton wrote:
> >In the chat-log rule, look for anything: someone saying something,
> someone
> >leaving, someone arriving, and check them all each time. Before I
> finsihed
> >came the Shocker: omigod. What if two new participants get added at once?
> >Or what if some state change propagates and causes two chat participants
> >to exclaim "Omigod!"? Omigod. I cannot code (some 'speech (participants
> >chat)). Omigod. Just as I have to check population changes /as well as/
> >speech acts, i have to check all speech acts!!!! You have no idea what I
> >am yelling about, do you?
>
> I think I do.  The problem is that you don't have "foreach" rules or
> second-order events.


Actually, I don't have /any/ Cells rules or syntax other than to create the
Cells, classes, and observers. Inside a rule, one Just Writes Lisp. Someone
once asked whether I had any such things as a special construct for
iterating over a list, and I offered "some", which is a standard Lisp
keyword. I pointed out that one of the big wins of Cells is precisely that
one does not have to use special constructs to make the paradigm work --
that would weaken the system because then calling some 3rd-party library
function that happens to visit other Cells would not establish dependencies.
Never mind the hassle of forcing all /my/ library code to use Cells-ese to
iterate over lists or just access variables.

Make sense? Or did I misunderstand you?

My mistake was simply trying to be too clever. I thought I knew how Cells
worked. :) So I thought I could use SOME, which stops at the first non-nil
value. That was dumb. yes, ephemerals get reset right away so only one can
be /set/ at a time (since each set becomes a new moment in data-time), but
Cells has evolved lately and ephemerals can start as non-nil or be ruled
(hmm, I might have to test that last one <g>), so it is now possible for
more than one ephemeral to hold a value during one "moment" as you say. Bots
in a game might have a rule determining their speeches, and all decide to
yell "Run away!" at the moment a rabbit appears. :)

kenny


 In traditional rule-driven systems, you can
> effectively say "for each X and Y that meet criterion Z, do A(X,Y)".  If I
> understand correctly, the only way to do this in Cells would be to put a
> collection in a cell and then have a rule that created a collection of
> corresponding objects from it, or at least transformed any changes in the
> collection into ephemeral add/remove events.
>
> In other words, Cells itself only deals with first-order (zeroth order?)
> changes to values and objects.  It does not deal with *sets* of values or
> objects.  It seems to me that this is the underlying nature of the problem
> you encountered.
>
> Probably the simplest way to solve it in the general case is with a stock
> object that transforms a collection into plural add/remove events.  Even
> better, two of them: one that monitors a cell with a collection, and the
> other an object that looks like a collection but exposes event
> cells.  These would be roughly equivalent to rule cells and input cells,
> respectively, but for collections of values instead of individual ones.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cells-devel/attachments/20060613/f4efdda3/attachment.html>


More information about the cells-devel mailing list