Just assign meaningful names to your variables and you should see the
problem...
Your original suggestion:
(defrule load_breakfast
(more ?moreToTotal)
?totalFactAddress <- (total ?totalFactAddress)
=>
(retract ?totalFactAddress)
(assert (total (+ ?totalFactAddress ?moreToTotal))
)
The key flaw is in trying to match (total ?totalFactAddress)...
A modified version:
(defrule load_breakfast
(more ?moreToTotal)
?totalFactAddress <- (total ?totalAmount)
=>
(retract ?totalFactAddress)
(assert (total (+ ?totalAmount ?moreToTotal))
)
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Christo Andonyadis
> Sent: Monday, April 26, 1999 1:40 PM
> To: [EMAIL PROTECTED]
> Subject: JESS: modify,retract
>
>
> I always have trouble getting retract or modify to work.
> If (assert (total 0)) gets asserted somewhere, and I want to add to in
> another rule:
>
> (defrule load_breakfast
> (more ?m)
> ?t <- (total ?t)
> =>
> (modify ?t (+ ?t ?m))
> )
> or
> (retract ?t)
> (assert (total (+ ?t ?m))
>
> I get messages like:
> ATTENTION: Rete Exception in routine Fact::FindSlot while executing
> defrule load_breakfast.
> Message: Attempt to find named slot in ordered fact at line 0: ( run
> ) .
>
> Anyone know the answer?
>
> Thanks
> Christo
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list. List problems? Notify [EMAIL PROTECTED]
> ---------------------------------------------------------------------
>
---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------