Search code examples
prologsemantics

PROLOG, meaning of


I don't understand what is the meaning of

[sopio|...], [...|...]|...

in the result of ?- findall([X,Y], indirectowner(X, Y), L).:

L = [[sopio, badri], [temur, badri], [temur, leila], [badri, anuki], [badri, tamar], [tamar, ioseb], [sopio, anuki], [sopio|...], [...|...]|...].

I have dafined following facts:

owner(sopio,badri).
owner(temur,badri).
owner(temur,leila).
owner(badri,anuki).
owner(badri,tamar).
owner(tamar,ioseb).

and clauses:

indirectowner(X,Z) :-
owner(X,Z).
indirectowner(X,Z) :-
owner(X,Y), owner(Y,Z).

Solution

  • The answer is abbreviated in order to avoid having too much output on the screen. In SWI-Prolog you can press w after the query to write the whole answer but for your query you need YOURquery ; true. because it is deterministic and for the w to be accepted it needs a non-deterministic query. You can also change the behaviour using Prolog flags.