Invoking a Callable Predicate from C

A Prolog predicate that has been made callable from foreign code can be invoked in two ways: determinately or nondeterminately. A determinate query asks for the first solution and the first solution only. A nondeterminate query allows Prolog to backtrack, possibly returning multiple solutions to the calling foreign function.

Note that the terms determinate and nondeterminate do not refer to the Prolog predicate being called, but rather to the query. It is perfectly reasonable to ask for only the first solution of a Prolog predicate that is nondeterminate, or to attempt to return all solutions to a predicate that in fact has just one. Multiple solutions, if any, are returned in the Prolog solution order. When only a single solution is desired a determinate call is preferred, as it is more efficient and concise.