Similar to copy_term/2,
but only rename the variables in VarsIn that appear in In.117This
predicate is based on a similar predicate in s(CASP) by Joaquin Arias.
Variables in In that do not appear in VarsIn are shared
between In and Out. Sub terms that only contain
such shared variables are shared as a whole between In and Out. VarsIn
is often a list, but can be an arbitrary term. For example:
?- copy_term([X], q(X,Y), Vars, Term).
Vars = [_A],
Term = q(_A, Y).
Note that if VarsIn and In do not share any
variables,
Out is equivalent to In and VarsOut is
a copy (as copy_term/2)
of VarsIn. If In does not contain any variables
not in VarsIn the result is the same as
copy_term(VarsIn-In, VarsOut-Out
).