User Session

The query answer loop of the Prolog interpreter repeatedly prompts a query and answers it by showing the variable bindings. The query answer loop can be started by the predicate prolog/0 and entered recursively by the predicate break/0. The query answer loop can be terminated by issuing an end of file.

Examples:
?- ?- break, p(X).
[1] ?- assertz(p(a)).
Yes
[1] ?-
X = a

The system predicates abort/1, exit/1 and close/1 throw some well-known system errors. The system predicate exit/1 allows terminating the query answer loop similarly like issuing an end of file. The system predicate abort/1 only terminates the current query but continues the loop. The system predicate close/1 recursively terminates all query answering loops.

Top-level answers are displayed with the operator (=)/2. For custom forms delivered by a printable hook the operator (is)/2 is displayed. For custom constraints delivered by an equation hook the corresponding operator is displayed. For printable and equation hooks see the module residue.

The following user session predicates are provided:
prolog:
break:
The predicate prompts and answers queries until an end of file is encountered.
abort:
The predicate throws a system error of type user abort.
exit:
The predicate throws a system error of type user exit.
close:
The predicate throws a system error of type user close.

The following Prolog flags for user sessions are provided:

sys_attached_to:
The legal value is a graphic interface component per interpreter. The type depends on the current platform and toolkit. The value can be changed.
sys_belongs_to:
The legal value is a graphic interface component per knowledge base. The type de-pends on the current platform and toolkit. The value can be changed.
sys_break_level:
The legal value is an integer. The value indicates the number of currently entered breaks. The default value is 0. The value can be changed.
sys_print_map:
The legal value is a variable names map. The value indicates the variable names of the current query. The default value is []. The value can be changed.

The following thread flags for user sessions are provided:

sys_tprompt:
The legal values are "off", "answer_cut", "ask_debug" and "on". The value indicates the prompt type or a prompt response. The default value is "off". The value can be changed.

Kommentare