/1¶
(G -> H)
Call goal H once per each solution of goal G.
The built-in *->3
is usually called from within a disjunction. It performs similar to ->//33
, with the difference that it will backtrack over the test goal. Consider the following small data-base:
a(1). b(a). c(x).
a(2). b(b). c(y).
Execution of an *->//33 query will proceed as follows:
?- (a(X)->b(Y);c(Z)).
X = 1,
Y = a ? ;
X = 1,
Y = b ? ;
X = 2,
Y = a ? ;
X = 2,
Y = b ? ;
no
The system will backtrack over the two solutions for a//11
and the two solutions for @ref U60UbU2fU_1 "b//1"1, generating four solutions.
Cuts are allowed inside the first goal __G__, but they will only prune over __G__.
If you want __G__ to be deterministic you should use if-then-else, as it is both more efficient and more portable.