Is there a way for me to get the fact ID of a fact that I just asserted in the RHS of a rule? Something along the lines of

?f <- (assert (new-fact))
有帮助吗?

解决方案

CLIPS> 
(defrule example
   =>
   (bind ?f (assert (new-fact)))
   (bind ?i (fact-index ?f))
   (printout t "The fact index is " ?i crlf))
CLIPS> (reset)
CLIPS> (run)
The fact index is 1
CLIPS> (facts)
f-0     (initial-fact)
f-1     (new-fact)
For a total of 2 facts.
CLIPS> 
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top