copy_term(?term, ?term) [ISO]

Term duplication, unify the second argument with a freshly renamed copy of the first.

see also: arg/3 freeze/2 functor/3 melt/3 number_vars/3 =../2

Example
copy_term(f(X, Y), Z). Succeeds with the substitutions:
X=__1
Y=__2
Z=f(__4, __5)
As can be seen from the variable identifiers which are displayed the copied term is a complete and distinct copy of the first argument
copy_term(a, 'ok'). fails

 

 

info@trinc-prolog.com