File "attrvars"

The delay of a goal G(X) on a variable X, creates a circular dependency, modelled by a compound '$ATTR'/2. Currently we do not provide the usual attributed variable schema with put_attr/3, etc... Similarly, as of now the utility predicate deref/2 resp. unify/2 should be called, instead of (=)/2, when the participation of attributed variables is assumed.

dif/2, freeze/2 and when/2 were realized with minimum guards for maximum performance. The end-user might nevertheless see freeze(X, member(X, [1,2])) and dif(X, 1) not producing X = 2, due to the myopic nature of the predicates. More advanced inferencing can be found in constraint programming libraries and/or custom attributed variables programming.

The following attrvars predicates are provided:

deref(S, T):
The predicate succeeds in T with the value of the term S. A variable is elevated to an attributed variable.
unify(S, T):
The predicate succeeds if S and T unify while maintaining waken goal success.
dif(S, T):
The predicate posits that S and T are different.
freeze(T, G):
The predicate delays the goal G until nonvar(T).
when(C, G):
The predicate delays the goal G until condition C. The available conditions are:

A, B: The conjunction of two conditions A and B.
A; B: The disjunction of two conditions A and B.
nonvar(T): The test that nonvar(T) holds.
ground(T): The test that ground(T) holds.