【发布时间】:2018-10-24 18:57:49
【问题描述】:
我正在从以下link做运动
这是知识库:
house_elf(dobby).
witch(hermione).
witch(’McGonagall’).
witch(rita_skeeter).
magic(X):- house_elf(X).
magic(X):- wizard(X).
magic(X):- witch(X).
我希望以下查询返回 true:
?- magic(’McGonagall’).
但是,我在 Windows 7 上的 SWI-Prolog(AMD64,多线程,版本 7.6.4)返回以下内容:
ERROR: Stream user_input:450:4 Syntax error: Unexpected end of clause
?- magic('McGonagall').
ERROR: Undefined procedure: wizard/1
ERROR: In:
ERROR: [9] wizard('McGonagall')
ERROR: [8] magic('McGonagall') at c:/users/some_user/google drive/projects/nlp/prolog/code/ex2_2.pl:6
ERROR: [7] <user>
Exception: (9) wizard('McGonagall') ? creep
Exception: (8) magic('McGonagall') ? creep
?-
为什么会失败?
【问题讨论】:
-
您定义了
with事实,但您调用了wizard/1,这是未定义的。
标签: prolog