I know that rules in CLIPS are usually given names using defrule
. This rule is called rule1
:
(deftemplate animal (slot species))
(deffacts animal
(animal (species dog)))
(defrule rule1
(animal (species ?name))
=>
(printout t ?name crlf))
(reset)
(run)
(exit)
;
But I still don't know whether it is necessary for the rules to be named. Is it possible to define a rule without giving it a name, like this?
(deftemplate animal (slot species))
(deffacts animal
(animal (species dog)))
(defrule
(animal (species ?name))
=>
(printout t ?name crlf))
(reset)
(run)
(exit)
;