I am totally new to CLIPS and I would like to know how could we call a defrule inside another defrule. For example if one rule does a regular job like printing or swapping, and another rule wants to call it after doing pattern-matching itself; how could the second rule call the first one in its pattern-matching part? Thank you
Asked
Active
Viewed 98 times
1 Answers
0
Chain rules by asserting a fact from one rule that activates another.
CLIPS (6.31 6/12/19)
CLIPS>
(defrule start
=>
(assert (r1)))
CLIPS>
(defrule rule-1
(r1)
=>)
CLIPS> (watch rules)
CLIPS> (watch activations)
CLIPS> (watch facts)
CLIPS> (agenda)
0 start: *
For a total of 1 activation.
CLIPS> (run)
FIRE 1 start: *
==> f-1 (r1)
==> Activation 0 rule-1: f-1
FIRE 2 rule-1: f-1
CLIPS>

Gary Riley
- 10,130
- 2
- 19
- 34