and the executionp(1). report(Term) :- writeln(term=Term), suspend(report(Term),3,Term->inst).
report/1 is woken and executed three times, once for each variable binding. If instead we do the three bindings under high priority, it will only execute once after all bindings have already been done:[eclipse 2]: report(f(X,Y,Z)), p(X),p(Y),p(Z). term = f(X, Y, Z) term = f(1, Y, Z) term = f(1, 1, Z) term = f(1, 1, 1)
[eclipse 3]: report(f(X,Y,Z)), call_priority((p(X),p(Y),p(Z)), 2). term = f(X, Y, Z) term = f(1, 1, 1)