2
votes

I want to increment security when the rule is run. Right now it changes nothing. The fact (human_resources n) does exist.

(defglobal ?security = 0)

(defrule rule1 (human_resources n) => (defglobal ?security = (+ ?security 1)) )

This results in ?*security = 1: (defglobal ?security = 0) (defglobal ?security = (+ ?security 1))

1

1 Answers

5
votes
CLIPS> (defglobal ?*security* = 0)
CLIPS> 
(defrule rule1
   (human_resources n)
   =>
   (bind ?*security* (+ ?*security* 1)))
CLIPS> (reset)
CLIPS> ?*security*
0
CLIPS> (assert (human_resources n))
<Fact-1>
CLIPS> (run)
CLIPS> ?*security*
1
CLIPS>