【发布时间】:2015-09-27 04:08:39
【问题描述】:
我无法理解 CLIPS 的工作原理。我需要像“mooo -> cow”这样的回答。这是我的代码。
(deftemplate animal (slot name)(slot sound))
(deffacts Input_animal
(animal(name cow)(sound mooo))
(animal(name dog)(sound barf))
(animal(name cat)(sound meuw))
(animal(name sheep)(sound me-e-e))
(animal(name duck)(sound cuack))
)
(defrule sound_animal
(sound ?x)
(animal(name ?animal)(sound ?x))
=>
(printout t ?animal crlf)
)
(defrule no_sound_animal
(sound ?x)
(not(animal(name ?animal)(sound ?x)))
=>
(printout t ?x => "the animal doesn't exist" crlf)
)
.
然后我把它放在控制台上: (观看规则) (看事实) (观看调用) (重启) (跑) (sound_animal (sound mooo))
我得到了这个答案: [EXPRNPSR3] 声音的 Miising 函数声明
嗯...我在看像“动物->牛”之类的东西 有人能帮我解决这个问题吗?我知道这应该很简单,但我卡住了...谢谢!!
【问题讨论】:
标签: declarative clips