% A demon that wakes whenever X becomes more constrained report(X) :- suspend(report(X, Susp), 1, X->constrained, Susp). :- demon report/2. report(X, _Susp) :- var(X), writeln(constrained(X)). % implicitly re-suspend report(X, Susp) :- nonvar(X), writeln(instantiated(X)), kill_suspension(Susp). % remove from the resolvent [eclipse 1]: report(X), notify_constrained(X), wake, notify_constrained(X), wake. constrained(X) constrained(X) X = X Delayed goals: report(X) yes. [eclipse 2]: report(X), notify_constrained(X), wake, X=123. constrained(X) instantiated(123) X = 123 yes.