12.3.59 SP_next_solution()

Synopsis

     #include <sicstus/sicstus.h>
     
     int
     SP_next_solution(SP_qid query);

Look for the next solution to the given query.

Arguments

query
The query, created by SP_open_query().

Return Value

SP_SUCCESS for success, SP_FAILURE for failure, SP_ERROR if an error condition occurred.

Description

This will cause the Prolog engine to backtrack over any current solution of an open query and look for a new one. The given argument must be the innermost query that is still open, i.e. it must not have been terminated explicitly by SP_close_query() or SP_cut_query(). Only when the return value is SP_SUCCESS are the values in the query arguments valid, and will remain so until backtracking into this query or an enclosing one.

See Also

Finding Multiple Solutions of a Call.


Send feedback on this subject.