JESS: short circuit pattern matching?

"Donald Winston" <[email protected]>
Newsgroups gmane.comp.java.jess
Message-ID <888_1289505219_oABJpuhF003095_E0ACA18E-9AFF-413F-8CF1-A92E66ABA9DB@yahoo.com>
If I've two rules I'd like to turn into one doing something like "fact pattern1 | pattern2" then if pattern1 succeeds will pattern2 be evaluated? Pattern2 will be a function I don't want to execute if the pattern1 succeeds. For example could I use one rule for the following? (I'd have to use a less specific error message)

(defrule VALIDATE::purchase-info-creditCardNumber
    (declare (salience 10))
    (page "purchase-subscription.xslt")
    ?fact <- (purchase-info (creditCardNumber ~~/^((67\\d{2})|(4\\d{3})|(5[1-5]\\d{2})|(6011))(\\s?\\d{4}){3}|(3[4,7])\\d{2}\\s?\\d{6}\\s?\\d{5}$/))
=>
    (modify ?fact
        (creditCardNumberError "credit card number format is invalid")
        (has-errors TRUE)))

(defrule VALIDATE::purchase-info-creditCardNumber-Luhn
    (page "purchase-subscription.xslt")
    (purchase-info (creditCardNumberError nil))
    ?fact <- (purchase-info (creditCardNumber ?ccn&: (Functions.isNotValidCC ?ccn)))
=>
    (modify ?fact
        (creditCardNumberError "credit card number failed Luhn algorithm")
        (has-errors TRUE)))

Donald Paul Winston
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.