Hi Ning,
A (test) CE is only evaluated whenever the pattern immediately preceding
it in the rule is matched. For rules like these, where the (test) Ce is
the only pattern on the LHS, an implicit pattern (initial-fact) is
inserted before the (test). You can use the ppdefrule command to
verify this.
Anyway, this means that the two (test) CEs are both evaluated
immediately after you issue the (reset) command, when (initial-fact)
is asserted. At that time, ?*gg* is 1, so only g_rule_1 is activated.
This behaviour is inherited from all other Rete-based shells. I should,
and will, clarify this in the documentation.
I think Ning Zhong wrote:
>
> Dear jess users,
>
> suppose the following jess program is executed,
> ----------------------------
>
>
> (defglobal ?*gg* = 1)
>
> (defrule g_rule_1
> (test (eq ?*gg* 1))
> =>
> (bind ?*gg* 2)
> (printout t "gg=" ?*gg* crlf)
> )
>
> (defrule g_rule_2
> (test (eq ?*gg* 2))
> =>
> (bind ?*gg* 3)
> (printout t "gg=" ?*gg* crlf)
> )
>
> ---------------------------------------
> I expect that both rule g_rule_1 and g_rule_2 would fire. But
> only rule g_rule_1 is fired. Could anybody explain this?
>
> Thanks in advance,
>
> Ning
>
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
> ---------------------------------------------------------------------
> 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]
> ---------------------------------------------------------------------
>
>
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9214 [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. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------