CLIPS 如何将从文件读取的数据绑定到一个变量
CLIPS How can I bind data read from a file to one variable
(deftemplate startup-rule
(multislot output)
(slot state))
(defrule end-state
=>
(open "output.dat" theFile "r")
(bind ?data (readline theFile))
(while (neq ?data EOF)
(bind ?data (?data readline theFile)))
(assert (startup-rule (output ?data)(state final)))
(close theFile) )
在这个 defrule 中,我试图将从文件中读取的所有行绑定到 ?data 变量中,以便之后断言到 deftemplate 启动规则中,但是这似乎不起作用。
(defrule end-state
=>
(open "output.dat" theFile "r")
(bind ?str "")
(bind ?data (readline theFile))
(while (neq ?data EOF)
(bind ?str (str-cat ?str ?data))
(bind ?data (readline theFile)))
(assert (startup-rule (output ?str) (state final)))
(close theFile))
(deftemplate startup-rule
(multislot output)
(slot state))
(defrule end-state
=>
(open "output.dat" theFile "r")
(bind ?data (readline theFile))
(while (neq ?data EOF)
(bind ?data (?data readline theFile)))
(assert (startup-rule (output ?data)(state final)))
(close theFile) )
在这个 defrule 中,我试图将从文件中读取的所有行绑定到 ?data 变量中,以便之后断言到 deftemplate 启动规则中,但是这似乎不起作用。
(defrule end-state
=>
(open "output.dat" theFile "r")
(bind ?str "")
(bind ?data (readline theFile))
(while (neq ?data EOF)
(bind ?str (str-cat ?str ?data))
(bind ?data (readline theFile)))
(assert (startup-rule (output ?str) (state final)))
(close theFile))