Consider the query:
?- consult([foo1,foo2]).where both foo1 and foo2 contain clauses for, say, baz/1. We get the following:
The procedure baz/2 is being redefined.Therefore, as far as is possible, avoid splitting your predicate definitions between files.Old file: /u/user5/ai/staff/paulb/foo1.pl
New file: /u/user5/ai/staff/paulb/foo2.pl
Do you really want to redefine it? (y, n, p, or ?) ?
The command reconsult(foo) is equivalent to consult(foo). The command reconsult(foo) can be rewritten as [-foo] and the command reconsult([foo1,foo2]) can be rewritten as [-foo1,-foo2].Some Prolog systems distinguish these commands. For these systems, the command consult([foo1,foo2]) has the consequence of loading the syntactically correct clauses found both in foo1 and in foo2 ---if they share the definition of baz/2 then both parts of the definition will be loaded.
Finally, if you really have to distribute your predicate definitions between files with a command like consult([foo1,foo2]) then there must be a declaration that the predicate is a multifile predicate before SICStus encounters the first clause. So, if baz/2 is shared between files, we need to place
:- multifile baz/2.before the first clause for baz/2.
Even though mostly you won't need to do this, there are occasions when it does make sense to distribute a predicate across several files.