:- block +BlockSpec
Specifies conditions for blocking goals of the predicates referred to by BlockSpec.
Goal template or list of goal templates, of the form
Each Argn is one of:
When a goal for a block declared predicate is
to be executed, the block specs are interpreted as conditions for
blocking the goal, and if at least one condition evaluates
true, the goal is blocked.
A block condition evaluates to
true iff all arguments
specified as ‘-’ are uninstantiated, in which case the
goal is blocked until at least one of those variables
is instantiated. If several conditions evaluate to
the implementation picks one of them and blocks the goal
The recommended style is to write the block declarations in front of the source code of the predicate they refer to. Indeed, they are part of the source code of the predicate, and must precede the first clause. For example, with the definition:
:- block merge(-,?,-), merge(?,-,-). merge(, Y, Y). merge(X, , X). merge([H|X], [E|Y], [H|Z]) :- H @< E, merge(X, [E|Y], Z). merge([H|X], [E|Y], [E|Z]) :- H @>= E, merge([H|X], Y, Z).
merge/3 having uninstantiated arguments in
the first and third position or in the second and
third position will suspend.
The behavior of blocking goals for a given predicate on uninstantiated arguments cannot be switched off, except by abolishing or redefining the predicate.