On May 24, 2007, at 12:50 AM, Nara Hari wrote:
I have a jess rule which is something like:
(defrule rule1
(template_name
(test (and (< ?var1 ?var2)
(>= ?var1 ?var3)))
=>
(printout "rule matches"))
I'm going to imagine it looks like this:
(defrule rule1
(template_name (slot1 ?var1) (slot2 ?var2) (slot3 ?var3))
(test (and (< ?var1 ?var2) (>= ?var1 ?var3)))
=> ...
Is there some other alternate to define the above rule without the
"test"
operator?
You can almost always turn a "test" CE into a predicate constraint:
(defrule rule1
(template_name (slot2 ?var2)
(slot3 ?var3)
(slot1 ?var1&:(and (< ?var1 ?var2) (>= ?var1 ?
var3))))
=> ...
In Jess 7, you can write this using the new "Java pattern" syntax:
(defrule rule1
(template_name {slot1 < slot2 && slot1 >= slot3})
=> ...
---------------------------------------------------------
Ernest Friedman-Hill
Advanced Software Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://www.jessrules.com
--------------------------------------------------------------------
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]
--------------------------------------------------------------------