我在 Mac OSX 上的 SWI Prolog 中的 ?- 提示符后尝试了各种括号和单引号组合。没有任何效果。这个命令应该一次加载一堆文件吗?我什至在到达 ?- 提示符之前就输入了一些东西吗?
如果有人能准确地告诉我在下面的#1 中输入什么,那就太好了。(我不是程序员,但我一直在尝试寻找一个简单的专家系统外壳,用于我的认知科学课程介绍。我已经尝试了大约一百万次 Amzi 鸟的东西,但除了错误什么也没有得到Amzi 和 SWI)。谢谢!
Prolog 专家系统 (APES) http://apes.sourceforge.net/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
跑步:
- 安装 swi-prolog (应该在任何 ISO 标准 Prolog 解释器上工作,但这是未经测试的)
- 运行“swipl -f main.pl”
- 输入“开始”。
更新:(非常感谢hardmath和user882813!)我得到一个命令不存在错误“swipl -f main.pl”,所以我手动启动了SWI Prolog abd加载main.pl。这是 main.pl 的代码:
% A Prolog Expert System (APES)
% http://apes.sourceforge.net/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
:- ensure_loaded('engine.pl').
:- ensure_loaded('tokenizer.pl').
:- ensure_loaded('parser.pl').
:- ensure_loaded('knowledge/knowledge.pl').
:- ensure_loaded('knowledge/groups/*.pl').
:- ensure_loaded('helpers.pl').
:- ensure_loaded('processor.pl').
start:-
%dynamic((::)/2),
write('_____________________________________________________'),
nl,nl,
loop_read_in(_).
loop_read_in(X):-
% from tokenizer.pl (clocksin & mellish, "programming in prolog"):
read_in(X),
process(X),
loop_read_in(_).
loop_read_in(X):-
read_in(X),
not(process(X)),
!,fail.
但这是发生的事情:当我输入开始时,我得到一个文件不存在错误:错误:/Users/leesebastiani/prologfiles/main.pl:10: source_sink `knowledge/groups/*.pl' 不存在
但是当我尝试手动加载时,我得到了这个:?- ['knowledge/groups/*.pl']。错误:/Users/leesebastiani/prologfiles/main.pl:10:source_sink `knowledge/groups/*.pl' 不存在警告:/Users/leesebastiani/prologfiles/main.pl:10:目标(指令)失败:用户:ensure_loaded(知识/组/*.pl)
我想让我的学生轻松做到这一点。这是我最后一次完整的会议:
?- ['main.pl'].
% engine.pl compiled 0.00 sec, 64 clauses
% tokenizer.pl compiled 0.00 sec, 62 clauses
% parser.pl compiled 0.00 sec, 32 clauses
% knowledge/knowledge.pl compiled 0.00 sec, 17 clauses
ERROR: /Users/leesebastiani/prologfiles/main.pl:10:
source_sink `knowledge/groups/*.pl' does not exist
Warning: /Users/leesebastiani/prologfiles/main.pl:10:
Goal (directive) failed: user:ensure_loaded(knowledge/groups/*.pl)
% helpers.pl compiled 0.00 sec, 24 clauses
% processor.pl compiled 0.00 sec, 12 clauses
% main.pl compiled 0.01 sec, 227 clauses
true.
?- ['knowledge/groups/*.pl'].
% knowledge/groups/feline.pl compiled 0.00 sec, 2 clauses
% knowledge/groups/pet.pl compiled 0.00 sec, 5 clauses
true.
?- ['main.pl'].
ERROR: /Users/leesebastiani/prologfiles/main.pl:10:
source_sink `knowledge/groups/*.pl' does not exist
Warning: /Users/leesebastiani/prologfiles/main.pl:10:
Goal (directive) failed: user:ensure_loaded(knowledge/groups/*.pl)
% main.pl compiled 0.00 sec, 1 clauses
true.
?-
感谢您的任何建议!