Re: how to rename variables?



On 2007-08-25, Markus Triska <triska@xxxxxxxx> wrote:
Chip Eastham <hardmath@xxxxxxxxx> writes:

you will need to apply copy_term/2 to each entry in the list

You can also use:

%?- Ls = [X+Y, f(X,g(X))], findall(C, member(C, Ls), Cs).
%@ Cs = [_G317+_G318, f(_G306, g(_G306))]

And copy_term(T, C) can also be obtained by: findall(T, T==T, [C]).

True, but copy_term/2 is more efficient and the detailed semantics
of bagof, setof and findall are not that clear. In general, I try
to avoid them.

Cheers --- Jan
.



Relevant Pages