freeze(?term, ?frozen_term)

This predicate creates a frozen term. A copy of the term to freeze is made and that copy is frozen. In the frozen term all uninstantiated variables are assigned unique constants. A frozen term can be manipulated as a ground term. The difference between a frozen term and a ground term is that the frozen term can be melted back into a nonground term.

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

Examples
freeze(a(A), C). succeeds with the substitution C=a(var/1)
freeze(a(A, B, A), C). succeeds with the substitution C=a(var/1, var/2, var/1))
freeze(a(a, b, A), C). succeeds with the substitution C=a(a, b, var/1)

 

 

info@trinc-prolog.com