There is a small bug in the 'actually-remove-things-from-c' rule: (remove ?c ?b?) should be (remove ?c ?x)
Anyway, is 'do-something-when-something-gets-removed-from-c' guaranteed to fire? If 'actually-remove-things-from-c' fires before, then 'do-something-when-something-gets-removed-from-c' will not fire, since ?c was already modified! Henrique
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ernest Friedman-Hill Sent: woensdag 20 februari 2008 13:31 To: jess-users Subject: Re: JESS: Rules for detecting changes of a multislot Lars, ... (defrule remove-something-from-c ?c <- (C (m ?a ?b ?c)) => (modify ?c (m ?a ?c))) You'd say something like (defrule want-to-remove-something-from-c ?c <- (C (m ?a ?b ?c)) => ;; Instead of modifying ?c, issue a command to do so (assert (remove ?c ?b))) (defrule actually-remove-things-from-c "Process commands to remove items from multislot m of C facts" (declare (no-loop TRUE)) ?c <- (C (m $?first ?x $?rest)) (remove ?c ?b) => (modify ?c (m $?first $?rest))) (defrule do-something-when-something-gets-removed-from-c "This is the rule you were asking about how to write" ?c <- (C (m $?first ?x $?last)) (remove ?c ?x) => (do whatever you want to do here)) (defrule clean-up-remove-commands "A low salience rule to clean up remove commands when you're done with them." (declare (salience -1)) ?r <- (remove ? ?) => (retract ?r)) ...
-------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------
