我很难理解如何discontiguous/1在(SWI)Prolog中正确使用谓词.
让buumi.pl这个伪事实的小文件:
discontiguous(buumi/1).
buumi(eins).
buri(zwei).
buumi(drei).
Run Code Online (Sandbox Code Playgroud)
swipl -s Buumi.pl然而,跑步仍会发出此警告:
% swipl -s Buumi.prolog
Warning: [...]/Buumi.prolog:5:
Clauses of buumi/1 are not together in the source-file
Run Code Online (Sandbox Code Playgroud)
文档非常含糊,只是陈述
discontiguous :PredicateIndicator, ...
但没有给出如何使用它的具体例子.我发现了一些例子表明我正确使用它; 至少,swipl并没有抱怨,但是再一次,它也不尊重我的要求.我在这做错了什么?
discontiguous/1是ISO指令.你必须把它作为
:- discontiguous(pred/2).
Run Code Online (Sandbox Code Playgroud)
在Prolog文本的开头.