File "compat"

This Prolog text provides further built-ins for control flow and integers, as seen in many other Prolog systems. The module originally started with the predicate forall(A, B) which is a short-hand for \+ ( A, \+ B). The evaluable function gcd/3, etc.. and the predicates nonground/2, divmod/3, etc.. are not required by the ISO core standard.

The following compat evaluable functions are provided:

gcd(X, Y, Z):
If X and Y are integers then the predicate succeeds in Z with the greatest common divisor of X and Y.

The following compat predicates are provided:

forall(A, B): [N208 8.10.4]
The predicate succeeds when there is no success of A such that B fails. Otherwise, the predicate fails.
try_call_finally(S, G, C):
The predicate succeeds whenever G succeeds. The goal S is called for the call and redo port. The goal C is called for the exit, fail and error port.
set_arg(K, X, Y):
Same as change_arg/3, but the change is undone upon backtracking.
undo(U):
The predicate succeeds. The goal U is called for the redo port of the last goal with redo port.
setup_undo(S, U):
The predicate succeeds whenever S succeeds. The goal U is called for the redo port of the last goal with redo port.
term_singletons(T, L):
The built-in succeeds in L with the singleton variables of T.
ground(T): [TC2 8.3.10]
The built-in succeeds if T is ground.
nonground(T, V):
The built-in succeeds if T is non-ground and V is the first variable.
divmod(X, Y, Z, T):
If X and Y are both integers then the predicate succeeds in Z with the division of X by Y, and in T with the modulo of X by Y.