• Hello,

    in the Basic Programmers Guide, you write about the way, an OR-condition is handled. An OR-condition will be translated to several new rules and thereby, the OR-condition itself will be replaced by one of the conditions inside the OR. Okay, i understand, why that work in simple cases. But, when my OR-condition is nested e.g. in a NOT-condition, like here:

    CLIPS> (deftemplate wurst (slot name) (slot gewicht) )
    CLIPS> (assert (wurst (name "bockwurst") (gewicht 100) ))
    CLIPS> (assert (wurst (name "bratwurst") (gewicht 200) ))
    CLIPS> (assert (wurst (name "grillwurst") (gewicht 300) ))
    CLIPS> (defrule rarara
          (wurst (name "hanswurst"))
          (wurst (gewicht 200))
      (printout t "fofo" crlf)

    it is not as simple as that, is it? how is an OR-condition handled in this and in similar cases?

    Thank you,
    Josef Hahn

    • Gary Riley
      Gary Riley

      From the Basic Programming Guide: Or CEs Following Not CEs

      If an or CE immediately follows a not CE, then the not/or CE combination is replaced with an
      and/not CE combination where each of the CEs contained in the original or CE is enclosed
      within a not CE and then all of the not CEs are enclosed within a single and CE. For example,
      the following rule

      (defrule example
         (a ?x)
         (not (or (b ?x) 
                  (c ?x)))

      would be changed as follows.

      (defrule example
         (a ?x)
         (and (not (b ?x)) 
              (not (c ?x)))