![]() |
YAP 7.1.0
|
Modules | |
Implementing Attributed Variables and Co-Routining | |
class copy_term/3 |
copy_term(? TI,- TF,- Goals)
Term TF is a variant of the original term TI, such that for each variable V in the term TI there is a new variable V' in term TF without any attributes attached Attributed variables are thus converted to standard variables Goals is unified with a list that represents the attributes The goal maplist(call, _Goals_)
can be called to recreate the attributes
Before the actual copying, copy_term/3
calls attribute_goals/1
in the module where the attribute is defined
class call_residue_vars/2 |
call_residue_vars(: G, L)
Call goal G and unify L with a list of all constrained variables created during execution of G:
class attribute_goals/3 |
attribute_goals(+ Var,- Gs,+ GsRest)
This nonterminal, if it is defined in a module, is used by copy_term/3 to project attributes of that module to residual goals It is also used by the toplevel to obtain residual goals after executing a query
Normal user code should deal with put_attr/3 , get_attr/3 and del_attr/2 The routines in this section fetch or set the entire attribute list of a variables Use of these predicates is anticipated to be restricted to printing and other special purpose operations
class call_residue/2 |
call_residue(: G, L)
Call goal G If subgoals of G are still blocked, return a list containing these goals and the variables they are blocked in The goals are then considered as unblocked The next example shows a case where dif/2 suspends twice, once outside call_residue/2 , and the other inside:
The system only reports one invocation of dif/2 as having suspended