(defrule r1 (a ?n) (a ?n2&:(< ?n ?n2)) => (assert (c (+ ?n ?n2))))
I think Francisco Dario wrote: > > Hi everyone. > I'm relative new with JESS... > > I have the following problem: > > consider this rule: > > (defrule r1 > (a ?n) > (a ?n2) > => > (assert (c (+ ?n ?n2)))) > > What I want is a rule that asserts the fact c only when there are two > distinct facts ex.: (a 1) and (a 3) generates (c 4) > > The first problem I had, was that when I asserted the first fact and execute > the "(run)", the rule "fired". I understood the question, and rewrote the > rule: > > (defrule r1 > ?fact1 <-(a ?n) > ?fact2 <-(a ?n2) > (test (not (eq ?fact1 ?fact2))) > => > (assert (c (+ ?n ?n2)))) > > This way, the same fact won't activate the rule. But now I have another > problem: When I assert the second fact, this new rule is activated twice! I > see why. But I want the rule to be activated only once! How can I overcome > this problem? > > > Thanx for any help. > Dario > > > > > > > > > > _________________________________________________________________ > Chat with friends online, try MSN Messenger: http://messenger.msn.com > > > -------------------------------------------------------------------- > 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] --------------------------------------------------------------------
