I am currently writing a program that will simulate the propositional laws. I have received a function my-test to determine whether certain characters are in a string and i works fine if i pass only a single slot variable but it won#t accept a multislot/multi value variable.
I have go the code working i f a pass for example ?sigle but if I try and pass $?symbol to the program it says that it is epecting a string or symbol.
(deftemplate sentence (multislot sent))
(defrule read-from-user
=>
(bind ?response "")
(printout t "Please enter a sentence: Use ~ for not and => for implies, or(v) and and(^) please. For predicates use { and } Example exists{richard}" crlf)
(bind ?response (explode$ (readline)))
(bind ?response (replace-member$ ?response "(" (sym-cat "(")))
(bind ?response (replace-member$ ?response ")" (sym-cat ")")))
(bind ?response (replace-member$ ?response "~" (sym-cat "~")))
(bind ?response (replace-member$ ?response "v" (sym-cat "v")))
(bind ?response (replace-member$ ?response "=>" (sym-cat "=>")))
(bind ?response (replace-member$ ?response "^" (sym-cat "^")))
(bind ?response (replace-member$ ?response "[" (sym-cat "[")))
(bind ?response (replace-member$ ?response "]" (sym-cat "]")))
(bind ?response (replace-member$ ?response "{" (sym-cat "{")))
(bind ?response (replace-member$ ?response "}" (sym-cat "}")))
(assert (sentence (sent ?response))))
(deffunction my-test ($?symbol) (not (or (str-index "^" ?symbol) (str-index "v" ?symbol))))
(defrule negative
(sentence (sent $?before "~" "(" "~" $?symbol ")" $?after))
(test (my-test $?symbol))
=>
(assert (sentence (sent $?before $?symbol $?after))))
(run)
Please enter a sentence: Use ~ for not and => for implies, or(v) and and(^) please. For predicates use { and } Example exists{richard}
~(~P v Q)
[ARGACCES2] Function 'str-index' expected argument #2 to be of type symbol, string, or instance name.
[PRCCODE4] Execution halted during the actions of deffunction 'my-test'.
This is the error i receive when i run the program i have a feeling that i need to do a conversio but am not quite sure what exctly needs to be done. Thx for the help