0
votes

I found function CLIPS Validate Text Entry there and I want to extend it this way:

(deffunction ask-question (?mark ?question $?allowed-values)    
      (printout t ?question)    
      (bind ?answer (read))    
      (if (lexemep ?answer) 
            then (bind ?answer (lowcase ?answer))
      **(assert car-mark(name ?mark))**
    )    (while (not (member ?answer ?allowed-values)) do
      (printout t ?question)
      (bind ?answer (read))
      (if (lexemep ?answer) 
          then (bind ?answer (lowcase ?answer))
          **(assert car-mark(name ?mark))**
       )
    )    ?answer)

So, I plan to add new car-mark in my facts if user input yes/y - else - not to add facts. But clips gives the error:

[PRNTUTIL2] Syntax Error: Check appropriate syntax for RHS patterns.

ERROR:

(deffunction MAIN::ask-question
   (?mark ?question $?allowed-values)
   (printout t ?question)
   (bind ?answer (read))
   (if (lexemep ?answer)
      then
      (bind ?answer (lowcase ?answer))
      (assert car-mark

There is my template for car-mark:

(deftemplate car-mark (slot name) )

How to correctly add new fact and consider user input (yes - add, no - no add)?

1

1 Answers

0
votes
(assert (car-mark (name "foo")))