jess

i don´t know why this example of the jess rule manual doesn´t work


I am reading the jess manual, exactly in 6.12. The 'test' conditional element. I copied exactly the example for try running this code, but didn´t work at all. NOTE: I have run another examples and work fine.

(deftemplate person (slot age))

(defrule example-8
    (test (eq 4 (+ 2 2)))
        =>
           (printout t "2 + 2 is 4!" crlf))

My result is nothing.. don´t show me any message, don´t return any error message. I really want to understand it. Please help me on this.


Solution

  • Many rules — and this is one — require the “initial-fact” asserted by “reset” to operate. The manual explains in more detail, but just as a best practice, you generally need to call (reset) before asserting any facts and calling (run).