[ Advanced Control and Suspensions | Reference Manual | Alphabetic Index ]
subcall(+Goal, -Delayed_goals)
Succeeds iff Goal succeeds and unifies Delayed_goals with a list of
remaining delayed goals.
- Goal
- Atom or compound term.
- Delayed_goals
- Variable or list.
Description
Calls the goal Goal. When Goal succeeds, Delayed_goals is unified with
a list of goals that were delayed, but not resumed during execution of
Goal. These goals, together with the variable bindings in Goal, can be
regarded as a qualified answer to Goal. I.e. Goal is true under the
condition that the conjunction of delayed goals is also true.
Note that, after exiting from subcall/2, the goals collected in
Delayed_goals do no longer exist as delayed goals.
Modules
This predicate is sensitive to its module context (tool predicate, see @/2).
Fail Conditions
Fails if Goal fails
Resatisfiable
Resatisfiable if Goal is resatisfiable
Exceptions
- (4) instantiation fault
- Goal is not instantiated.
- (5) type error
- Goal is neither an atom nor a compound term.
- (68) calling an undefined procedure
- Goal is an undefined procedure.
Examples
Success:
[eclipse]: X > 0, subcall(X < 5, DG).
X = X
DG = [X < 5]
Delayed goals:
X > 0
yes.
[eclipse]: subcall( (X > 0, Y > 0, X = 3) , DG).
Y = Y
X = 3
DG = [Y > 0]
yes.
Fail:
subcall(fail, _).
Error:
subcall(Var, D). (Error 4).
subcall(3, D). (Error 5).
subcall(foo(a), D). (Error 68).
See Also
call / 1, @ / 2, : / 2, call_priority / 2