when(@Condition, 
:Goal)?=(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).