[ Forwarded for Jason Morris -- Moderator ]
I think that Roger Studner wrote:
> > Can someone explain slot-specific to me?

You've stumbled right into what Dr. Friedman-Hill warns about in
section 7.15 in the Jess documentation.  You're modifying a slot that
is *not* part of the LHS, so Jess will still match your rule's LHS on
the next cycle -- nothing has changed the patterns that caused the
initial activation.  This infinite loop, which you observe, is called
refraction.

Refraction bugs typically occur when you code a rule to take some
action(s) that do not depend upon variables that were matched on the
LHS.  You expect Jess to stop once it has matched the patterns and
performed the action(s), but the rule engine still sees the fact(s)
that caused the rule to initially activate.  Slot-specific simply
forces the rule to only fire once.  You'll also want to look up:

http://herzberg.ca.sandia.gov/jess/docs/70/rules.html#no-loop

BTW - This also brings up the good house-keeping habit of retracting
unused facts that have served their purpose so that they don't cause
unexpected side-effects.

I suspect that a better way to do what you are attempting is to use
one of Jess's neatest new features:  the (accumulate) conditional
element.

http://herzberg.ca.sandia.gov/jess/docs/70/rules.html#accumulate_ce

This is ideal for counting facts -- simply bind the accumulated count
to a variable in the CE as per the documentation example.  Then,
modify your count slot on the RHS using that bound variable.

Hope this helps!
Cheers,
Jason

-----------------------------------------------------
Morris Technical Solutions LLC
www.morristechnicalsolutions.com
[EMAIL PROTECTED]
phone/fax: 503.692.1088

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