(eq) is deliberately very picky about the comparisons it makes. It
returns true only if both the value and the type of its arguments are
identical. From what you've shown here, it looks as if it should pass,
but perhaps your actual program is subtly different, such that one
version of 3 is a string, or float, or long, while the other is an
int.

In any case, you should generally use "=" to mean numeric equality. It
will do whatever it takes to interpret its arguments as generic
numbers that can be properly compared. So while (eq 3 3.0), (eq 3 "3")
and (eq 3 (long 3)) are all FALSE, (= 3 3.0), (= 3 "3") and
(= 3 (long 3)) are all TRUE. See if this doesn't help.


I think Richard Patten wrote:
> 
> Hello everybody,
>     I am having a small problem at the moment.
> 
> I have the following two rules 
> 
> (defrule myRule2
>    (Stat homedomain-mch1.1097.ActionInitiators.TelephoneExchange.explainSituation    
>       ?explainSituation &: (eq ?explainSituation 3))
> =>
>    (printout t "Fired the rule" crlf)
> )
> 
> (defrule myRule3
>    (Stat homedomain-mch1.1097.ActionInitiators.TelephoneExchange.explainSituation    
>    ?explainSituation &: (< ?explainSituation 3 ))
> =>
>    (printout t "Fired the rule2" crlf)
> 
> )
> 
> The following facts are inserted one after another.  After each fact is inserted the 
>run() command is called in JESS.
> 
> (assert (Stat 
>homedomain-mch1.1097.ActionInitiators.TelephoneExchange.explainSituation  1))
> (run)
> (assert (Stat 
>homedomain-mch1.1097.ActionInitiators.TelephoneExchange.explainSituation  2))
> (run)
> (assert (Stat 
>homedomain-mch1.1097.ActionInitiators.TelephoneExchange.explainSituation  3))
> (run)
> 
> The first two facts work fine, I get the output
> Fired teh rule2
> Fired teh rule2
> 
> But when I try the third fact I get no output at all, which means 'myRule2' is not 
>firing.  But when I change 
> 
> (Stat homedomain-mch1.1097.ActionInitiators.TelephoneExchange.explainSituation  
>?explainSituation &: (eq ?explainSituation 3))
> 
> to
> 
> (Stat homedomain-mch1.1097.ActionInitiators.TelephoneExchange.explainSituation  
>?explainSituation &: (> ?explainSituation 2))
> 
> then the rule fires.  Can someone please tell me what is going wrong.
> thanks
> Richard.
> 
> 
> 
> 
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Web Hosting - Let the expert host your site



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