6.5.1 Finding One Solution of a Call

The easiest way to call a predicate 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 you are only interested in the side-effects of a predicate you can call SP_query_cut_fail(). It will try to prove the predicate, cut away the rest of the solutions, and finally fail. This will reclaim any memory used after the call, and throw away any solution found.


Send feedback on this subject.