The assert action allows the user to add a fact to the fact-list. Multiple facts may be asserted with each call. If the facts item is being watched (see section 13.2), then an informational message will be printed each time a fact is asserted.
Syntax
(assert <RHS-pattern>+)
Missing slots in a template fact being asserted are assigned their default value (see section 3). If an identical copy of the fact already exists in the fact-list, the fact will not be added (however, this behavior can be changed, see sections 13.4.4 and 13.4.5). Note that in addition to constants, expressions can be placed within a fact to be asserted. The first field of a fact must be a symbol. The value returned of the assert function is the fact-address of the last fact asserted. If the assertion of the last fact causes an error, or if an identical copy of the fact already exists in the fact-list, then the symbol FALSE is returned.
Example
CLIPS> (clear) CLIPS> (assert (color red)) <Fact-0> CLIPS> (assert (color blue) (value (+ 3 4))) <Fact-2> CLIPS> (assert (color red)) FALSE CLIPS> (deftemplate status (slot temp) (slot pressure)) CLIPS> (assert (status (temp high) (pressure low))) <Fact-3> CLIPS> (facts) f-0 (color red) f-1 (color blue) f-2 (value 7) f-3 (status (temp high) (pressure low)) For a total of 4 facts. CLIPS>