| Did you know ... | Search Documentation: | 
|  | when.pl -- Conditional coroutining | 
This library implements the when/2 constraint, delaying a goal until its arguments are sufficiently instantiated. For example, the following delayes the execution of =:=/2 until the expression is instantiated.
    ...
    when(ground(Expr), 0 =:= Expr),
 when(+Condition, :Goal)
 when(+Condition, :Goal)nonvar(X)ground(X)
For example (note the order a and b are written):
?- when(nonvar(X), writeln(a)), writeln(b), X = x. b a X = x