I am having problems in transforming this code ?a &:(= (+ ?b ?c) ?a)
in something more simple and more efficient in clips.
Can someone help me?
Use =(+ ?b ?c) if you don't need to reference the variable ?a again, otherwise use ?a&=(+ ?b ?c)
CLIPS>
(defrule example-1
(factoid ?b ?c)
(factoid =(+ ?b ?c))
=>)
CLIPS>
(defrule example-2
(factoid ?b ?c)
(factoid ?a&=(+ ?b ?c))
=>
(printout t ?a crlf))
CLIPS> (assert (factoid 1 2) (factoid 3))
<Fact-2>
CLIPS> (agenda)
0 example-1: f-1,f-2
0 example-2: f-1,f-2
For a total of 2 activations.
CLIPS>