I have this following rule in my CLIPS file:
(defrule check-final (declare (salience 12))
?scnt <- (set-count (value ?v) (class ?c))
(test (= ?v ?*tot
Pattern matching for this rule occurs whenever the fact set-count
is asserted or modified. The rule is fired some time afterwards, during the call to run
. These two processes can be widely separated in time. The value of ?*v*
can of course change during that long period of time.
The key is to realize that he printed results will reflect the value of ?v
from the the epoch during which pattern matching happened, while ?*total*
will be the value when the results are printed. Since ?*total*
may have seen arbitrary changes since the pattern matching, there's no guarantee that it will be equal to ?v
when the rule actually fires.