获得我刚刚断言的事实ID

时间:2013-05-26 20:49:22

标签: clips

我有没有办法获得我刚刚在规则的RHS中声明的事实的事实ID?

的内容
?f <- (assert (new-fact))

1 个答案:

答案 0 :(得分:1)

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>