5
votes

I'm struggling to understand how to properly use the discontiguous/1 predicate in (SWI) Prolog.

Let buumi.pl be this little file of pseudo-facts:

discontiguous(buumi/1).

buumi(eins).
buri(zwei).
buumi(drei).

Running swipl -s Buumi.pl however still gives this warning:

% swipl -s Buumi.prolog
Warning: [...]/Buumi.prolog:5:
        Clauses of buumi/1 are not together in the source-file

The documentation is quite vague and simply states

discontiguous :PredicateIndicator, ...

but gives no concrete example on how to use it. I've found some examples that suggest that I'm using it correctly; at the very least, swipl doesn't complain, but then again, it doesn't honour my request either. What am I doing wrong here?

2

2 Answers

9
votes

discontiguous/1 is an ISO directive. You have to put it as

:- discontiguous(pred/2).

at the beginning of the Prolog text.

0
votes

I'm using SWI-Prolog version 8.2.4 for x86_64-linux.

My WARNINGS say to enter

:- discontiguous pred-name/1.

This eventually did work and I get an output like below after loading the prolog file:

?- consult('animals.pl').     (My entry)

  true.                       (SWIPL response)

Each predicate name has to be explicitly entered or else SWIPL assumes the default rule for undeclared predicates and outputs the same old warning.