unifiy_with_occurs_check/2

unifies two terms, where the occurs check will be taken in account.

unify_with_occurs_check(?Term1, ?Term2)

'='/2 succeeds when Term1 and Term2 are unifiable in such a way that they are identical and fails if they are not unifiable and identical.
The difference to =/2 is that the predicate fails, if you try to create an inifite term.

Arguments

Term1                  term
Term2                  term

Examples

unify_with_occurs_check(f(X,1), f(1,X)). Succeeds with substitution X <- 1.
unify_with_occurs_check(f(X),X). Fails.

Standard

This predicate is part of the ISO-Prolog Standard.

See also

=/2, \=/2.


Darueber read on...