Module assume

Clauses and attributed variable hooks are identified by their reference data type. Other modules provide the creation of these objects, adding and removing these objects to and from their parent objects. This module provides trailed updates on these objects.

Example:
?- assumable_ref(foo(123), X), depositz_ref(X), foo(Y).
X = 0r139b8d9f,
Y = 123
?- foo(Y).
The predicates deposita_ref/1 respectively depositz_ref/1 will assume the given clause or hook for the duration of the continuation, whereas the predicate withdrawa_ref/1 respectively withdrawz_ref/1 will retire the given clause or hook for the duration of the continuation.

The following assumption toolbox predicates are provided:

deposita_ref(R):
The predicate temporarily inserts the clause or hook referenced by R at the top for the duration of the continuation.
depositz_ref(R):
The predicate temporarily inserts the clause or hook referenced by R at the bottom for the duration of the continuation.
withdrawa_ref(R):
The predicate temporarily removes the clause or hook referenced by R for the duration of the continuation. The undo will happen at the top.
withdrawz_ref(R):
The predicate temporarily removes the clause or hook referenced by R for the duration of the continuation. The undo will happen at the bottom.

Kommentare