SP_query()
#include <sicstus/sicstus.h> int SP_query(SP_pred_ref predicate, SP_term_ref arg1, ...);
Calls a predicate, committing to its first solution.
SP_SUCCESS
if the goal succeeded,
SP_FAILURE
if it failed, and
SP_ERROR
if an error condition occurred.
Use this if you are only interested in the first solution is to call
the function SP_query()
. It will create a goal from the
predicate definition and the arguments, call it, and commit to the
first solution found, if any. If it returns SP_SUCCESS
, values in the
query arguments valid, and will remain so until
backtracking into any enclosing query.
Finding One Solution of a Call.