The general trick is to write the rule such that it doesn't match
after the value is set; i.e.,

;; default value is the symbol UNDEFINED
(deftemplate formula (slot ...) (slot value (default UNDEFINED)))

(defrule set-value
  ?f <- (formula ... (value UNDEFINED))
  =>
  ;; Fact won't match this rule anymore
  (modify ?f (value 37)))

Jess 7 is going to provide other ways of dealing with this particular
situation. 

I think =?iso-8859-4?Q?Raoul_J=E4rvis?= wrote:
[Charset iso-8859-4 unsupported, filtering to ASCII...]
> Hello,
> 
> I have the following small problem:
> 
> I am using rules to perform computation on a set of formulas.
> Basically for every fact I have a rule that specifies how to calculate the value 
> (slot) for this fact.
> So on the LHS of the rule I am binding the facts whose values are used/needed as 
> arguments for calculating the fact's value. Once the value is calculated I need to 
> modify the fact to update its value. 
> So my question is, how can I bind the fact to be calculated on the RHS? If I bind it 
> on the LHS of the rule, then the modification of the fact by the same rule will put 
> the rule back on the agenda and it will be fired again, although the "argument" 
> facts that would affect the calculation result have not changed. So basically every 
> rule is fired one "extra" time. How can I prevent that. Can I bind the fact that I'm 
> calculating on the RHS or are there any other solutions for this problem?
> 
> Thank you in advance,
> Raoul
> 



---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems 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