|Did you know ...||Search Documentation:|
|Warning: (file:line) Redefined static procedure: name/arity|
:- multifile p/1. p(a). p(b).
:- multifile p/1. p(1). p(2).
:- [file1]. % loads p_1/1 :- [file2]. % loads p_2/1 p(X) :- p_1(X). p(X) :- p_2(X).
The advantage of the multifile/1 based approach is that it is simple and all lookup is fully indexed. The price is that you have little control over the order of the clauses. If you modify file 1 and reload it, its clauses will now be after those from file 2. Make sure that the order does not matter! The second appraoch maintains the order of answers. This approach is typically preferred if the facts from file 1 and file 2 are conceptually different, e.g., the first defines people and the second organizations.