How to run Prolog

How you start Prolog depends on your operating system; try typing prolog at the top-level prompt. Prolog should respond with the ``| ?-'' prompt.

To load in predicates from file, use reconsult(FileName) or reconsult([FileName1, FileName2, ...]). If one of the files contains a predicate that already occurs in the database, it replaces the old definition. [The similar predicate consult adds the new clauses after the existing predicates, rather than replacing them.]

To type in predicates directly, use reconsult(user). The prompt will change from ``| ?-'' to ``|''. Enter predicates as you would on a file. To quit this mode, enter an end-of-file (probably ^D).

``Run'' the program by typing in inquiries at the Prolog prompt. You may call any predicate with any arguments, and you may make multiple calls in one inquiry by separating them with commas. Use a period at the end of each inquiry. There is no ``main'' program.

When Prolog does not give you a new prompt after it answers an inquiry, that means there may be other answers. Enter


;<return>
to tell it to get the next answer, or just <return> to tell it you have seen enough.

To begin tracing, use trace; to end tracing, use notrace. To exit Prolog, use halt.

Previous page
Table of contents
Next page


Copyright © 1995 by David Matuszek
All rights reserved.
Last updated July 15, 1995