使用剪辑时试图收回事实
trying to retract facts when using clips
我是剪辑新手,我发现我的retract
并没有真正删除事实。
(defrule test
(select ?select~indoor&~outdoor)
=>
(retract ?select)
)
剪辑完运行这段代码后,我尝试用(facts)
查看,结果还是发现select
的事实还在
您需要将变量绑定到与模式匹配的事实。您不能通过将变量绑定到事实中的值来撤销事实。
CLIPS (6.31 2/3/18)
CLIPS>
(defrule test
?f <- (select ...)
=>
(retract ?f))
CLIPS> (assert (select ...))
<Fact-1>
CLIPS> (facts)
f-0 (initial-fact)
f-1 (select ...)
For a total of 2 facts.
CLIPS> (run)
CLIPS> (facts)
f-0 (initial-fact)
For a total of 1 fact.
CLIPS>
我是剪辑新手,我发现我的retract
并没有真正删除事实。
(defrule test
(select ?select~indoor&~outdoor)
=>
(retract ?select)
)
剪辑完运行这段代码后,我尝试用(facts)
查看,结果还是发现select
的事实还在
您需要将变量绑定到与模式匹配的事实。您不能通过将变量绑定到事实中的值来撤销事实。
CLIPS (6.31 2/3/18)
CLIPS>
(defrule test
?f <- (select ...)
=>
(retract ?f))
CLIPS> (assert (select ...))
<Fact-1>
CLIPS> (facts)
f-0 (initial-fact)
f-1 (select ...)
For a total of 2 facts.
CLIPS> (run)
CLIPS> (facts)
f-0 (initial-fact)
For a total of 1 fact.
CLIPS>