I think Judson, Ross wrote: > >From the wish-list department: I'd sure like it if, in the action > portion of a rule definition, I could define new rules. Sort of like > this: > > (defrule i-am-a-rule > (condition 1) > (condition 2) > => > (defrule subrule-1 > (condition) > => > (action)) > > (action) > ) >
You can achieve a quite similar effect using modules, optionally including the auto-focus declaration. (defmodule A) (defrule A::i-am-a-rule (declare (auto-focus TRUE)) (condition 1) (condition 2) => (action)) (defrule A::subrule-1 (condition 3) => (action)) The rule subrule-1 won't fire unless the rule i-am-a-rule is satsfied and grabs the module focus for module A. When any rules in A that apply are through firing, focus returns to the previous module (or you can use "return" to return earlier.) Module A is thus very much like a complex, multi-rule "daemon" that runs whenever a set of conditions are met. I use a technique like this in JIA for the user-input module in the Tax-forms Advisor in Part 3, and the Hardware Diagnostic Assistant in Part 4. > > In addition, it would be cool (don't you love hearing that ;) if you > could do this, instead of using salience: > > (defrule rule-3 > (declare (overrides i-am-a-rule)) > (condition) > => > (action)) > Interesting. This could certainly solve some common difficulties, and you're right that it's less messy than the traditional alternatives. Thanks for writing. You're usually a source of very good ideas! --------------------------------------------------------- Ernest Friedman-Hill Distributed Systems Research 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] --------------------------------------------------------------------
