2012-05-05 60 views
0

沒有任何人有任何想法,爲什麼這樣的:剪輯簡單的規則

(defrule initx 
     (declare(salience 90)) 
     => 
     (assert (blabla 10)) 
) 

(defrule gigel 
    (declare(salience 89)) 
     => 
     (printout t "test" crlf) 
) 

不工作? 當我刪除第一條規則時,它就起作用了。 謝謝。

回答

0

你看到了什麼行爲?無論是否存在initx規則,gigel規則的行爲都是相同的。

CLIPS> 
(defrule initx 
    (declare(salience 90)) 
    => 
    (assert (blabla 10))) 
CLIPS> 
(defrule gigel 
    (declare(salience 89)) 
    => 
    (printout t "test" crlf)) 
CLIPS> (reset) 
CLIPS> (run) 
test 
CLIPS> (facts) 
f-0  (initial-fact) 
f-1  (blabla 10) 
For a total of 2 facts. 
CLIPS> (clear) 
CLIPS> 
(defrule gigel 
    (declare(salience 89)) 
    => 
    (printout t "test" crlf)) 
CLIPS> (reset) 
CLIPS> (run) 
test 
CLIPS> (facts) 
f-0  (initial-fact) 
For a total of 1 fact. 
CLIPS>