Availability:built-in
read_term_with_history(-Term,
+Options)Read a term while providing history substitutions.
read_term_with_history/2
is used by the top level to read the user's actions. In addition to the
options recognised by read_term/2,
the following options are recognised:
- prompt(+Prompt)
- Define the prompt to use. The default is
~! ?-. A sequence
~! is replaced by the current history event number.
- show(+Command)
- Using Command lists the saved history events. Default is
!history.
- help(+Command)
- Using Command shows help on the history system. Default is
!help.
- no_save(+Commands)
- Do not save the command into the history if it appears in the list
Commands.
- module(+Module)
- Defines the module from which to extract module-specific syntax such as
operators and handling of the various quotes. Default is the typein
module which is set using module/1
and is initially set to
user.
- input(+Stream)
- Stream from which to read Term. Default is
user_input.
Most applications will use the read_term/2
option variable_names to get access to the names of the
variables in Term. SWI-Prolog calls read_term_with_history/2
as follows:
read_term_with_history(
Goal,
[ show(h),
help('!h'),
no_save([trace, end_of_file]),
prompt('~! ?-'),
variable_names(Bindings)
]).