11.3.8 ask_query/4 [hookable]

Synopsis

ask_query(+QueryClass, +Query, +Help, -Answer)

Prints the question Query, then reads and processes user input according to QueryClass, and returns the result of the processing, the abstract answer term Answer. The Help message may be printed in case of invalid input.

Arguments

QueryClass
term, must be nonvar

Determines the allowed values for the atom Answer.

Query
term

A message term.

Help
term

A message term.

Answer
term

See QueryClass

Description

All queries made by the system are handled by calling this predicate.

First ask_query/4 calls query_hook/6 with the same arguments plus the Query and Help arguments converted to format-command lines. If this call succeeds, then it overrides all further processing done by ask_query/4. Otherwise, the query is processed in the following way:

Exceptions

instantiation_error
QueryClass, Query, or Help uninstantiated.
type_error
QueryClass not an atom.
domain_error
QueryClass not a valid query class.

See Also

Query Processing.


Send feedback on this subject.