문제

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> 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top