copy_term/3
This commit is contained in:
parent
04fa96e8a0
commit
bdf8b890e3
@ -3257,6 +3257,15 @@ structure. All suspended goals and attributes for attributed variables
|
|||||||
in @var{TI} are also duplicated.
|
in @var{TI} are also duplicated.
|
||||||
|
|
||||||
Also refer to @code{copy_term/2}.
|
Also refer to @code{copy_term/2}.
|
||||||
|
|
||||||
|
@item copy_term(?@var{TI},-@var{TF},-@var{Goals})
|
||||||
|
@findex copy_term/3
|
||||||
|
@syindex copy_term/3
|
||||||
|
@cnindex copy_term/3
|
||||||
|
Term @var{TF} is a variant of the original term @var{TI}, such that for
|
||||||
|
each variable @var{V} in the term @var{TI} there is a new variable @var{V'}
|
||||||
|
in term @var{TF}. Attributed variables are converted to standard variables and the list @var{Goals} is unified with a set of goals that can be used to restore the constraints, by calling @code{attribute_goals/3} before copying is performed.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node Predicates on Atoms, Predicates on Characters, Testing Terms, Top
|
@node Predicates on Atoms, Predicates on Characters, Testing Terms, Top
|
||||||
|
@ -583,6 +583,22 @@ call_residue_vars(Goal,Residue) :-
|
|||||||
'$ord_remove'([V1|Vss], Vs0s, Residue)
|
'$ord_remove'([V1|Vss], Vs0s, Residue)
|
||||||
).
|
).
|
||||||
|
|
||||||
|
copy_term(Term, Copy, Goals) :-
|
||||||
|
term_variables(Term, TVars),
|
||||||
|
'$pick_vars_for_project'(TVars,AttVars),
|
||||||
|
'$call_attribute_goals'(AttVars, Goals0, LDs),
|
||||||
|
'$fetch_delays_and_simplify'(AttVars, LDs, LGs),
|
||||||
|
'$convert_att_vars'(AttVars, LGs),
|
||||||
|
copy_term_nat([Term|Goals0], [Copy|Goals]).
|
||||||
|
|
||||||
|
'$fetch_delays_and_simplify'(AttVars, LDs, LGs) :-
|
||||||
|
'$fetch_delays'(AttVars, LDs0, LGs),
|
||||||
|
'$fetch_delays_simplify'(LDs0, LDs).
|
||||||
|
|
||||||
|
'$fetch_delays_simplify'(LDs0, LDs0) :- var(LDs0), !.
|
||||||
|
'$fetch_delays_simplify'([_-G|LDs0], [G|LDs0]) :-
|
||||||
|
'$fetch_delays_simplify'(LDs0, LDs0).
|
||||||
|
|
||||||
call_residue(Goal,Residue) :-
|
call_residue(Goal,Residue) :-
|
||||||
var(Goal), !,
|
var(Goal), !,
|
||||||
'$do_error'(instantiation_error,call_residue(Goal,Residue)).
|
'$do_error'(instantiation_error,call_residue(Goal,Residue)).
|
||||||
|
Reference in New Issue
Block a user