A backward-chaining version of late-order would look something like
this. I moved the "after" test to the LHS of the rule not because you
have to, but because it's more efficient and better style to do it
that way. Also notice that I'm omitted the (extremely optional) "call"
functor.
(defrule late-order
(order (orderNumber ?orderNum)
(scheduledDeliveryDate ?schDeliveryDate)
(expectedDeliveryDate ?expDeliveryDate&:
(?schDeliveryDate after ?expDeliveryDate)))
(need-order-late (orderNumber ?orderNum))
=>
(assert (order-late (orderNumber ?orderNum) (timeDiff 500))))
Now, I'm not sure if this is ever really an "optimization." Things can
be made to work this way, but I don't know that it's particularly
better or worse.
---------------------------------------------------------
Ernest Friedman-Hill
Science and Engineering PSEs Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://herzberg.ca.sandia.gov
--------------------------------------------------------------------
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]
--------------------------------------------------------------------