sitelogo
copy_term/2

makes a copy of a term.

copy_term(+Term1, -Term2)

unifies Term2 with a copy of Term1 where all variables in Term1 are replaced by new variables.

Arguments

Term1                  term
Term2                  term

Examples

copy_term(f(a,b), X). Succeeds with substitution X <- f(a,b).
copy_term(f(A,B,A),C). Succeeds with substitution C <- f (_1,_2,_1).
copy_term(f(a, g(b,C)), f(A,Y)). Succeeds with substitution A <- a, Y <- g(b,_1).
copy_term(f(a,b), f(a,d)). Fails.

Standard

This predicate is part of the ISO-Prolog Standard.

See also

arg/3, functor/3, '=..'/2.


Darueber read on...
scroll to top managed with ubiCMS