I think =?ISO-8859-1?Q?=D1=EE=F0=EE=EA=E8=ED_=D0=F3=F1=EB=E0=ED?= wrote:
> 
> Dear friends!
> How information can be retained between two firing of the same rule without
> using global variables? I tryed to use auxiliary fact like this:
> (defrule R1
>       ?f1<-(fact1 (slot1 ?x) ...)
>       ?f2<-(fact2 (slot2 ?y) ...)
>       ...
>       ?f3<-(aux-fact (store-slot ?z))
>       =>
>       (use-somehow ?z)
>       (bind ?z (calculate-new-value))
>       (modify ?f3 (store-slot ?z))
> )
>       But this usage of a "modify" cause retracting and new asserting of the f3
> and firing of the R1 in advance with same f1 and f2. This hangs machine in
> a
> loop...


I'm not sure why you don't want to use a defglobal, but that's
certainly one perfectly good way to do what you want. Another would be
to use the "store" and "fetch" commands. A third would be to use the
"bag" command. Yet another would be to use Jess's reflection
capabilitiy to store ?z in some Java object. So there are many alternatives.

>       Mr.Friedman-Hill, may be it will be better if the function "modify"
> does'nt reassert fact, but only change slot value? Is it possibile somehow?
> Thank in advance.

By definition, modifying a fact should cause all LHS patterns to be
matched against that fact to see if there are any new matches. The
fact that this is implemented by removing the old fact and asserting a
new one doesn't really matter -- if Jess were changed in the way you
sugegst, this would not changed the observed behaviour, because this
would still be a new match (a new value of ?z). You'll have to use one
of the other alternatives above to store persistent data.



>       Ru Sorokin.
> 


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

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