怎么做逻辑或CLIPS?语法错误

时间:2018-02-24 12:52:50

标签: clips

我需要使用逻辑运算符或在这种情况下,但我得到此语法错误。写这个的确切语法是什么?

CLIPS> 
(defrule case2
   (or ((PNP Y) (PLF Y) (PIU Y))
       ((PNP Y) (PLF N) (PIU Y)))
   =>
   (printout t "- Check the printer-computer cable" crlf))

[PRNTUTIL2] Syntax Error:  Check appropriate syntax for the first field of a pattern.

ERROR:
(defrule MAIN::case2
   (or  ((
CLIPS> 

1 个答案:

答案 0 :(得分:0)

以下任何一种方法在语法上都是正确的,并会产生相同的结果:

(defrule case2
   (or (and (PNP Y) (PLF Y) (PIU Y))
       (and (PNP Y) (PLF N) (PIU Y)))
   =>
   (printout t "- Check the printer-computer cable" crlf))

(defrule case2
   (PNP Y) 
   (or (PLF Y) 
       (PLF N))
   (PIU Y)
   =>
   (printout t "- Check the printer-computer cable" crlf))

(defrule case2
   (PNP Y) 
   (PLF Y | N)
   (PIU Y)
   =>
   (printout t "- Check the printer-computer cable" crlf))