Module suspend

This Jekejeke Minlog module provides the delay of goals until certain variable conditions are satisfied. The predicate freeze/2 delays until the first argument is instantiated. The predicate when/2 delays until the first argument succeeds.

Example:
?- freeze(X, (write(foo), nl)).
freeze(X, (write(foo), nl))
?- freeze(X, (write(foo), nl)), X = a.
foo
X = a

The delayed goal is allowed to fail or to succeed multiple times. The when/2 predicate cur-rently understands as conditions conjunction (C1; C2), disjunction (C1; C2), variable instanti-ation nonvar(V) and ground-ness ground(V).

The following suspend predicates are provided.

freeze(V, G):
If V is a variable further checks are delayed until the variable is instantiated with a non-variable or another variable. Otherwise the goal G is directly called.
when(C, G):
If C simplifies to a non-trivial condition further simplifications are delayed until a variable in C is instantiated with a non-variable or another variable. Otherwise the goal G is directly called.

Comments