The goal freeze(X,Goal) is equivalent semantically to Goal, but its evaluation will be delayed until X becomes a nonvariable term. The following predicate defines freeze/2:
delay freeze(X,Goal):-var(X) : {ins(X)}. freeze(X,Goal):-true : call(Goal).As another example, consider the goal:
freeze(X,freeze(Y,q(X,Y)))This goal is equivalent to p(X,Y), which is defined as follows:
delay p(X,Y):-var(X) : {ins(X)}. delay p(X,Y):-var(Y) : {ins(Y)}. p(X,Y):-true : q(X,Y).A predicate call p(X,Y) will be delayed when either X or Y is a variable.
The following describes a delay condition that is difficult to describe by using freeze:
delay p(X,Y):-var(X),var(Y) : {ins(X),ins(Y)}. p(X,Y):-true : q(X,Y).A predicate call p(X,Y) will be delayed when both X and Y are variables.
In the example programs shown above, no delay clause contains actions and all triggers are ins. In the Chapter on Programming Constraint Propagation, we will show examples where actions and other types of triggers are used in delay clauses.