Prolog: Clauses are not together in source-file

intelis picture intelis · May 4, 2013 · Viewed 20.8k times · Source

I have this piece of code:

% Family tree
female(pen).
male(tom).
male(bob).
female(liz).
female(pat).
female(ann).
male(jim).

parent(pam, bob).
parent(tom, bob).
parent(tom, liz).
parent(bob, ann).
parent(bob, pat).
parent(pat, jim).

I get this error:

Warning: Clauses of female/1 are not together in source-file
Warning: Clauses of male/1 are not together in source-file

What is the purpose of this error?
I mean, file does compile and run just fine and I am aware of the meaning of the error. But why?
Is this just a notice to enforce best practice?

I am very new to logic programming.
Thanks!

Answer

Sergey Kalinichenko picture Sergey Kalinichenko · May 4, 2013

Correct, this is a warning to enforce best practices, which is to put all related clauses together in the source file. Other than that, the proximity of clauses to each other in the source file does not matter, as long as their relative order does not change.