Deena Sudheendran
Deena Sudheendran

Reputation: 25

Call one rule from another in clips

I wanted to know if there is any possibility of firing a rule from the RHS of another rule. for example,

rule 1:
(defrule printHello
=>
(printout t " Hello World" crlf ))

rule 2:
(defrule printName
=> 
/* tigger rule 1 */)

Upvotes: 1

Views: 343

Answers (1)

noxdafox
noxdafox

Reputation: 15060

Expert systems are knowledge representation engines. They use knowledge (static and dynamic) to represent their internal state. In CLIPS, dynamic knowledge is represented with facts.

You can use a custom dedicated fact for that.

(defrule printHello
  (print hello)
=>
  (printout t " Hello World" crlf))

(defrule printName
=>
  (assert (print hello)))
  

Upvotes: 1

Related Questions