如何在剪辑中获取事实中的值?
CLIPS> (assert(rule1 (read)))
4
==> f-1 (rule1 1)
我希望事实1存储在变量中并进行计算。
在这个例子中,我想返回一个值' 4'。
答案 0 :(得分:1)
CLIPS> (watch facts)
CLIPS> (assert (rule1 (read)))
4
==> f-1 (rule1 4)
<Fact-1>
CLIPS>
(defrule double
(rule1 ?v)
=>
(printout t "Twice the value is " (* 2 ?v) crlf))
CLIPS> (agenda)
0 double: f-1
For a total of 1 activation.
CLIPS> (run)
Twice the value is 8
CLIPS>