I think Rich Halsey wrote:

> It may be that I'm still confused as to the utility of your proposed
> feature.
> 

It comes up constantly on this list. One recent instance concerned a
system in which definstances were added in an uninitialized state, and
then various rules set their properties. Each time a property was set,
various initialization rules were re-activated. The rules had to be
written carefully to avoid this. If they were one-shot rules instead,
the intent could be expressd more succinctly; and even better, the
rules would be more independent, as they wouldn't need to worry
directly about the effect of other rules.

Here's another example:

(defrule count-x-facts
        (declare (one-shot TRUE))
        (x)
        ?count <- (count (x ?n))
        =>
        (modify ?count (x (+ ?n 1))))

Without the "one-shot" feature, this fires every time an X fact is
modified; with it, it fires only when one is first created. The
existing solution to this problen is exceedingly unsatisfying: you
need to add a "counted-already" slot to the "x" template and test it
on the LHS and set it to TRUE on the RHS. This is really, really
gross; the one-shot feature is far superior.



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

--------------------------------------------------------------------
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