0
votes

i am writing an expert system on cheese. when reset all the facts about various cheese is loaded into the system and by asking question such as texture smell etc this will retract certain facts from the system.

My Question how do you keep track of the amount of rules in the system. I created a count but i was wondering if there was a way to see the amount of facts currently in the system when running a rule.

Any help would be appriciated

1

1 Answers

0
votes

You can make a call to get-defrule-list or get-fact-list to determine the number of rules/facts present in the system:

CLIPS> (assert (a) (b) (c) (d))
<Fact-4>
CLIPS> (defrule x =>)
CLIPS> (defrule y =>)
CLIPS> (defrule z =>)
CLIPS> (length$ (get-defrule-list *))
3
CLIPS> (length$ (get-fact-list *))
5
CLIPS> (facts)
f-0     (initial-fact)
f-1     (a)
f-2     (b)
f-3     (c)
f-4     (d)
For a total of 5 facts.
CLIPS> (rules)
x
y
z
For a total of 3 defrules.
CLIPS>