Hi, I have the following piece of code
It just adds two words to the row template
Both are slot-specific TRUE, however, myrule gets reactivated after row templates being modified (infinite loop)
 
(clear)
(reset)
(watch all)
(deftemplate row (declare (slot-specific TRUE)) (slot y) (multislot data))
(deftemplate word  (declare (slot-specific TRUE)) (slot y) (slot text))
(assert (row (y 0)))
(assert (word (y 0) (text a)))
(assert (word (y 0) (text b)))
(defrule myrule
 ?row <- (row (y ?y) (data $?data))
 ?word <- (word (y ?y) (text ?text))
=>
 (bind $?data (insert$ $?data (+ (length$ $?data) 1) ?text))
 (printout t $?data crlf)
 (modify ?row (data $?data))
)
(run)
 
Thanks.
Yuping

Reply via email to