gpt4 book ai didi

prolog - 在Prolog中加载文件

转载 作者:行者123 更新时间:2023-12-03 13:21:04 24 4
gpt4 key购买 nike

我正在阅读Prolog教程。它告诉我可以通过键入以下内容来加载其他序言文件:

[filename].


但是每次我尝试这越来越

ERROR: load_files/2: Arguments are not sufficiently instantiated.


该文件与正在使用的文件位于同一目录中。

这是整个查询和错误的副本:

12 ?- [KB5].

ERROR: load_files/2: Arguments are not sufficiently instantiated


我究竟做错了什么?

最佳答案

$ cat junk.pl
test(ok).

$ prolog
Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 5.8.0)
Copyright (c) 1990-2009 University of Amsterdam.
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.

For help, use ?- help(Topic). or ?- apropos(Word).

?- [junk].
% junk compiled 0.00 sec, 24 bytes
true.


对我来说似乎很好。当然,我使用原子作为文件名,而不是变量。 (KB5是变量名,而不是原子。)首先尝试 ['KB5']看看是否有帮助。接下来尝试 [kb5]看看是否有帮助。最后,尝试一个绝对的最小示例,例如我提供的示例,看看是否可以那样加载。



编辑添加:

$ cp junk.pl JUNK.pl
$ prolog
Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 5.8.0)
Copyright (c) 1990-2009 University of Amsterdam.
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.

For help, use ?- help(Topic). or ?- apropos(Word).

?- [JUNK].
ERROR: load_files/2: Arguments are not sufficiently instantiated
?- ['JUNK'].
% JUNK compiled 0.00 sec, 1,656 bytes
true.


看起来确实像是原子问题。使用 ['KB5'],您的错误可能会消失。

关于prolog - 在Prolog中加载文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4495977/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com