Replace-member is not functioning and simply says that defrule syntax is invalid

时间:2019-04-16 22:25:37

标签: rules clips

Hi i have written a display method to display some facts but i wish to replace all of the "}" with ")". But my program will not accept the replace-member method

I have used he replace-member earlier in my code but it does not seem to work in this instance. I have tried with $? and ? with no difference

(deftemplate sentence (multislot sent) (slot or-to-implies-done) (slot implies-to-or-done) (slot comm-or) )

 some more code that creates the sentence 

(Actual method that isn't working)
(defrule display 
(sentence (sent $?check) (or-to-implies-done ~true) (implies-to-or-done ~true) (comm-or ~true))
(bind $?check (replace-member$ $?check "}" (sym-cat ")")))
 => 
(printout t (implode$ (apply sym-cat $?check)) crlf))

I simply wish to replace all the "}" with "(" by using the replace-member method. Any suggestions are much appreciated error simply says syntax is wrong in defrule with no further info given.

1 个答案:

答案 0 :(得分:0)

bind 函数调用移至规则的操作中:

(defrule display 
   (sentence (sent $?check) 
             (or-to-implies-done ~true) 
             (implies-to-or-done ~true) (comm-or ~true))
   => 
   (bind $?check (replace-member$ $?check "}" (sym-cat ")")))
   (printout t (implode$ (apply sym-cat $?check)) crlf))