0
votes
(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) )

In this defrule I am trying to bind all the lines being read from the file into the ?data variable to be asserted into the deftemplate startup-rule afterwards, however that does not seem to be working.

1

1 Answers

0
votes
(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))