Well, there are some weird things here, but first let me answer your
question: the variable ?count refers to the same value in every
pattern that it matches. The first slot matched to ?count binds a
value to it; later patterns must match the same value. So this rule
will only be activated when there is an aaa fact and a bbb fact, each
with "count" slots containing the same value, and that value is
simultaneously less then 100 and less than 1. Hence only the very
first time, when ?count is 0 in aaa, will the two facts match, since
?count is 1 in the aaa fact the next time around.

The weird thing is that you're using both defclass and deftemplate for
the same template name. (defclass) creates a deftemplate as a
side-effect (use (list-demplates) to see this.)  Current versions of
Jess silently ignore when you attempt to redefine a deftemplate, so
the explicit deftemplate constructs below are ignored since each
deftemplate has already been defined by the preceding defclass.


I think John Mela wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> ;; -*- clips -*-
> 
> (defclass aaa Aaa)
> (deftemplate aaa (slot name)(slot count)(slot OBJECT))
> (defclass bbb Bbb)
> (deftemplate bbb (slot name)(slot count)(slot OBJECT))
> 
> (defrule cycle
>       (aaa (name ?name) (count ?count&:(< ?count 100))(OBJECT ?aaa))
>       ?b <- (bbb (name ?name) (count ?count&:(< ?count 1))(OBJECT ?bbb))
>       =>
>       (set ?aaa count (+ ?count 1))
>       (retract ?b)
>       (assert (bbb (name "bbb")(count 0))) 
>       (printout t "count = " ?count crlf))
> 
> This rule only fires once. Since object aaa is changing [its count is being
> updated] I would expect the rule to fire 100 times. How can I get the rule
> to refresh itself and be put back on the agenda? 
> [I'm trying to time assert/rule fire/retract cycles]
> 
> thanks
> John Mela
> 
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list (use your own address!) List problems? Notify [EMAIL PROTECTED]
> ---------------------------------------------------------------------
> 



---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to