0

このコード?a &:(= (+ ?b ?c) ?a)をクリップでよりシンプルで効率的なものに変換する際に問題が発生しています。

誰かが私を助けることができますか?

4

1 に答える 1

1

変数 ?a を再度参照する必要がない場合は=(+ ?b ?c)を使用し、それ以外の場合は?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> 
于 2013-06-04T01:46:07.887 に答える