Menu

simple question (getting error )

Help
fatemeh
2013-04-28
2013-06-07
  • fatemeh

    fatemeh - 2013-04-28

    hi every one,I'm just getting familiar with clips so I'm sorry for my simple question.
    I'm trying to write a simple code in clips but I'm getting this error which i can't find what the problem is.
    I would be grateful if any one could help.

    Defining deffunction: user-Question
    Defining defrule: Rule0
    [PRNTUTIL2] Syntax Error: Check appropriate syntax for defrule.

    ERROR:
    (defrule MAIN::Rule0
    (not (tank-is-full ?)
    =>

    this is part of my code:

    ;;;*
    ;;;
    Functions

    ;;;
    ***
    (deffunction user-Question(?question ?answer $?values)
    (printout t ?question)
    (bind ?answer(read))
    (stringp ?answer)
    =>
    (bind ?answer(lowcase ?answer))

    (while (not (member$ ?answer ?values)) do
    (printout t ?question)
    (bind ?answer(read))
    (stringp ?answer)
    =>
    (bind ?answer(lowcase ?answer))
    )
    ?answer
    )

    ;;;***
    ;;;
    ENGINE STATE RULES
    ;;;***

    (defrule Rule0
    (not (tank-is-full ?)
    =>
    (bind ?tank-is-full user-Question("Is there any petrol in the tank(Yes|No)?"yes YES Yes NO no No)
    (assert(tank-is-full ?tank-is-full)
    )
    ;;;****

     
  • Gary Riley

    Gary Riley - 2013-06-07

    The rule has multiple missing/misplaced parentheses:

    (defrule Rule0
       (not (tank-is-full ?))
       =>
       (bind ?tank-is-full 
          (user-Question "Is there any petrol in the tank(Yes|No)?" 
                         yes YES Yes NO no No))
       (assert (tank-is-full ?tank-is-full)))
    
     

Log in to post a comment.