I'm thinking that this isn't declarative programming but more of a
procedural approach to problem solving.  In declarative programming,
theoretically anyway, each rule should be incrementally independent as
much as possible.  By putting the rules in a situation like that shown
below usually shows that the solution is not declarative but procedural.
If ruleA is true then check ruleB means that ruleB is dependent on
ruleA.  Rather the data of ruleB might have some data that is modified
by ruleA, then that would be declarative.

Maybe what you really want here is rule sets where a rule set is
activated only during the firing of certain rules.  Yes, I know:  That
isn't much different in practice but the thinking behind it is
significantly different.

SDG
jco
 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Judson, Ross
Sent: Tuesday, August 26, 2003 10:10 AM
To: [EMAIL PROTECTED]
Subject: JESS: Subrules


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


or

(defrule subrule-2 extends i-am-a-rule
  (condition)
=>
  (action))


When you're dealing with a lot of rules, this kind of thing can really
help set up more complex nested if-then-if-then type stuff.

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

The effect of that would be that for any given set of facts, if both
rule-3 and i-am-a-rule are activated, rule-3 fires, eliminating the
activation of i-am-a-rule.  

For a general and somewhat more specific rule that can match on the same
set of facts, there is no way to avoid using salience to perform the
discrimination, unless you break the matching up and use "signaling"
facts.  This is somewhat undesirable.  

RJ

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

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