8.2 Coroutining
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Constraint Logic Programming
        • Coroutining
          • dif/2
          • freeze/2
          • frozen/2
          • when/2
          • call_residue_vars/2
    • Packages
Availability::- use_module(library(when)).(can be autoloaded)
Sourcewhen(@Condition, :Goal)
Execute Goal when Condition becomes true. Condition is one of ?=(X, Y), nonvar(X), ground(X), ,(Cond1, Cond2) or ;(Cond1, Cond2). See also freeze/2 and dif/2. The implementation can deal with cyclic terms in X and Y.

The when/2 predicate is realised using attributed variables associated with the module when. It is defined in the autoload library library(when).