#include <quintus/quintus.h>
     int QP_close_query(qid)
     QP_qid qid;

Equivalent to the Prolog call:

     !, fail.


The cut renders the current computation determinate, removing the possibility of future backtracking. The following call to fail/0 then initiates backtracking to the first parent goal with outstanding alternatives. In doing so it pops the Prolog heap to its state when the parent goal succeeded, in effect throwing away any terms created since that parent goal.

In the context of calling Prolog from foreign languages, terminating a query using QP_close_query() generally means throwing away the last solution that was calculated, unless that solution has been copied into a more permanent place. (Of course, any previous solutions must also be assumed to have been overwritten by subsequent solutions unless copied elsewhere!) The converse of this behavior is that closing a query using QP_close_query() automatically frees up the Prolog memory that holds the last solution.

Return Values

Query was closed successfully
either the query could not be closed or an exception was signalled from Prolog but not caught

See Also

QP_cut_query(), QP_open_query(), QP_query(), QP_next_solution(), QP_pred(), QP_predicate(), fli-ffp