prompt/2
prompt(
-OldPrompt,
+NewPrompt)
Queries or changes the prompt string of the current input stream or an input stream Stream.
The old prompt atom.
The new prompt atom.
A prompt atom is a sequence of characters that indicates the Prolog system is waiting for input when a “Read” or “Get” predicate is called. If an input stream connected to a terminal is waiting for input at the beginning of a line (at line position 0), the prompt atom will be printed through an output stream associated with the same terminal.
Prolog sets the prompt to ‘|: ’ for every new top-level
query. This is the prompt that can be changed by invoking
prompt/2
.
Unlike state changes such as those implemented as prolog flags, the scope of a prompt change is a goal typed at the toplevel. Therefore, the change is in force only until returning to the toplevel (prompt = ‘| ?- ’).
To query the current prompt atom, OldPrompt and NewPrompt should be the same unbound variable.
To set the prompt, NewPrompt should be an instantiated atom.
The “Load” predicates change the prompt
during the time operations are performed: If a built-in loading
predicate is performed on user
(such as compile(user)
,
etc.), the prompt is set to ‘| ’. This prompt is not affected
by prompt/2
.
instantiation_error
type_error