when/2

support for when//22 built-in%

when(+ C,: G)*

Delay execution of goal G until the conditions C are satisfied. The conditions are of the following form:

  • C1, C2 Delay until both conditions C1 and C2 are satisfied.

  • C1; C2 Delay until either condition C1 or condition C2 is satisfied.

  • ?=( V1, C2) Delay until terms V1 and V1 have been unified.

  • nonvar( V) Delay until variable V is bound.

  • ground( V) Delay until variable V is ground.

Note that when//22 will fail if the conditions fail.