?- ['file1.pl'].Loads the file "file1.pl". Note the use of single quotes round the filename. These are necessary because it contains the character "." which has a special meaning in Prolog.
Multiple files can be loaded as follows:
would load (effectively reconsult) all three files into memory. On some Prolog
systems (including SWI-Prolog) the file extension ".pl" is assumed so that the last example can
be abbreviated by
?- [file1,file2,file3].Note that if the filename consists only of alphanumeric characters, there is no need for the single quote.
?- consult('lists.pl').opens the file lists.pl and loads the clauses in that file into memory. If this program was not correct, and one edited the file using the goal, then upon returning from the editor (and assuming that the new version of the file was resaved using the same file name), one could use the goal
? reconsult('lists.pl').to reload the clauses into memory, automatically replacing the old definitions. If one had here used 'consult' rather than 'reconsult' the old (and possibly incorrect) clauses would have remained in memory along with the new clauses (depends upon the Prolog system, actually).
If several files have been loaded into memory, and one needs to be reloaded, use 'reconsult'. If the reloaded file defines predicates which are not defined in the remaining files then the reload will not disturb the clauses that were originally loaded from the other files.
?-consult(user). or ?- reconsult(user). ?-[user].In the last case, the user types in clauses interactively, using period '.' at the end of clauses, and ^Z to end input.