I think Nicolas Fortin wrote:

> But Jess complains because (alphalist (alphalist $?c)) is not true. So I changed the 
> rule for :
> 
> (defrule modify-slot
> ?f <- (alphalist (alpha $?c))
>  =>
>  (modify ?f (alpha (create$ ?c d e f))))
> 
> However when I type (run), I get no response, the cursor is still blinking, and even 
> after a long delay, Jess never prompts again. What is wrong with this rule ?
> 

A rule like this that matches a fact, then modifies it such that the
fact still matches, leads to an infinite loop: the rule just keeps
firing and firing (although in this particular case if you wait long
enough, the multislot will grow so long Java will run out of memory.)

You have to change the rule so that it doesn't match after the modify
is done; for example

(defrule modify-slot
 ?f <- (alphalist (alpha $?c&:(not (member$ d ?c))))
 =>
 (modify ?f (alpha (create$ ?c d e f))))

Charlemagne has a special "no-loop" declaration that prevents this
kind of self-activation from happening.


---------------------------------------------------------
Ernest Friedman-Hill  
Advanced Software Research          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550         http://herzberg.ca.sandia.gov

--------------------------------------------------------------------
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]
--------------------------------------------------------------------

Reply via email to