如何在剪辑中与nil进行比较?
我试过了
(defrule update-time
?cur-time <- (current-time ?time)
(order (event-time ?new-time-o&:(neq ?new-time-o nil)))
我也试过
(neq ?new-time-o "nil")
似乎没有任何效果,我没有激活。
答案 0 :(得分:1)
您没有提供足够的信息来回答您的问题。给定适当的数据,此规则将激活:
CLIPS> (deftemplate order (slot event-time))
CLIPS>
(defrule update-time
?cur-time <- (current-time ?time)
(order (event-time ?new-time-o&:(neq ?new-time-o nil)))
=>)
CLIPS> (assert (order (event-time (time))))
<Fact-1>
CLIPS> (assert (current-time (time)))
<Fact-2>
CLIPS> (agenda)
0 update-time: f-2,f-1
For a total of 1 activation.
CLIPS>