Thanks, Ernest
Apparently u r right. But what I really need is whenever the variable ?x >=
0.9, printout "x is bigger than 0.9". According to the manual, "a test CE is
evaluated everytime the preceding pattern on the rule's LHS is evaluated",
then how about the rule shown below, it has no preceding pattern on the
rule's LHS?
(defrule a1 (test (> ?*x* 0.9)) => (printout t "x is bigger than 0.9"
crlf))
Do I have to add a pattern in front of test CE shown below to change patten
(a) to invoke the test CE.
(defrule a1 (a) (test (> ?*x* 0.9)) => (printout t "x is bigger than 0.9"
crlf))
Thanks!
-Yanguo
>
>
> I think Yanguo Jing wrote:
> [Charset iso-8859-1 unsupported, filtering to ASCII...]
> > Sorry Ernest, I send it to you by mistake.
> >
> > Dear all
> >
> > I wrote the following code, why it always said rule a1 have a mistake.
But I
> > can NOT find it?
> >
> > (defrule a0 =>(assert (a)) (bind ?x 0.91))
> > (defrule a1 (a) (test (> ?x 0.9)) => (printout t "x is bigger than 0.9"
> > crlf ) )
>
>
> This rule tests a variable ?x, but no variable ?x is defined on the
> left-hand-side of rule a1. Variables like ?x are local to the rule in
> which they are defined.
>
> If you want global variables, use a defglobal:
>
>
> (defglobal ?*x* = 0)
> (defrule a0 =>(assert (a)) (bind ?*x* 0.91))
> (defrule a1 (a) (test (> ?*x* 0.9)) => (printout t "x is bigger than
> 0.9" crlf))
>
>
> > (reset)
> > (run)
> >
> > Thanks!!
> >
> > Yanguo Jing
> > Intelligent System Laboratory
> > Department of Computing and Electrical Engineering,
> > Heriot-Watt University, Edinburgh, UK
> > EH14 4AS
> > Tel: +44 (0)131 449 5111 Ext. 4164
> > Fax: +44 (0)131 451 3327
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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]
> > ---------------------------------------------------------------------
> >
>
>
>
> ---------------------------------------------------------
> 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]
---------------------------------------------------------------------