12.3.81 SP_query()

Synopsis

     #include <sicstus/sicstus.h>
     
     int
     SP_query(SP_pred_ref predicate,
              SP_term_ref arg1,
              ...);

Calls a predicate, committing to its first solution.

Arguments

predicate
The predicate to call.
arg1...
The arguments to pass.

Return Value

SP_SUCCESS if the goal succeeded, SP_FAILURE if it failed, and SP_ERROR if an error condition occurred.

Description

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.

See Also

Finding One Solution of a Call.


Send feedback on this subject.