Next: mpg-ref-query_class, Previous: mpg-ref-put_code, Up: mpg-bpr [Contents][Index]
query_abbreviation/3
hook:- multifile 'SU_messages':query_abbreviation/3.
'SU_messages':query_abbreviation(+QueryClass, -Prompt, -Pairs)
A way to specify one letter abbreviations for responses to queries from the Prolog System.
atom
The query class being defined.
atom
The prompt to be used, typically indicating appropriate abbreviations.
list of pair
A list of word-abbreviation pairs, defining the characters accepted and the corresponding abstract answers.
This predicate defines a query class with the given prompt, the line
input
method, the char(Pairs)
map method and help_query
failure mode. The predicate is actually implemented by the first
clause of 'SU_messages':query_class/5
:
query_class(QueryClass, Prompt, line, char(Pairs), help_query) :- query_abbreviation(QueryClass, Prompt, Pairs), !.
Prolog only asks for keyboard input in a few different ways. These
are enumerated in the clauses for
'SU_messages':query_abbreviation/3
. These clauses specify
valid abbreviations for a given key word. For example,
query_abbreviation(yes_or_no, ' (y or n) ', [yes-[-1,0'y], no-"n"]) :- !.
a French translator might decide that the letters ‘O’ and ‘o’ are reasonable abbreviations for ‘oui’ (yes), and therefore write
query_abbreviation(yes_or_no, ' (y or n) ', [yes-[-1,0'o,0'O], no-"n"]) :- !.
ask_query/4
checks the output arguments.