11.3.247 when/2

Synopsis

when(+Condition,+Goal)

Blocks Goal until the Condition is true.

Arguments

Condition
callable, must be nonvar and one of:
nonvar(X)
False until X is nonvar.


ground(X)
False until X is ground.


?=(X,Y)
False while dif(X,Y) would block.


Condition,Condition
True if both conditions are true.


Condition;Condition
True if at least one condition is true.

:Goal
callable, must be nonvar

Backtracking

Depends on Goal.

Examples

     | ?- when(((nonvar(X);?=(X,Y)),ground(T)), process(X,Y,T)).

Exceptions

Call errors (see ref-sem-exc).

See Also

ref-sem-sec.


Send feedback on this subject.