diff --git a/docs/swi.tex b/docs/swi.tex index 6240ad1cd..a76a2164e 100644 --- a/docs/swi.tex +++ b/docs/swi.tex @@ -107,6 +107,13 @@ and change working directory to @var{New}. Use the pattern @code{working_directory(CWD, CWD)} to get the current directory. See also @code{absolute_file_name/2} and @code{chdir/1}. +@item @@@var{Term1} =@@= @@@var{Term2} +@findex =@@=/2 +@snindex =@@=/2 +@cnindex =@@=/2 + +True iff @var{Term1} and @var{Term2} are structurally equivalent. I.e. if @var{Term1} and @var{Term2} are variants of each other. + @end table @node Invoking Predicates on all Members of a List,Forall, , SWI-Prolog diff --git a/library/swi.yap b/library/swi.yap index b39fa2f88..bd3673575 100644 --- a/library/swi.yap +++ b/library/swi.yap @@ -20,7 +20,8 @@ :- use_module(library(terms),[term_variables/2, term_variables/3, - term_hash/2]). + term_hash/2, + variant/2]). :- multifile prolog:message/3. @@ -238,3 +239,7 @@ prolog:intersection([_|T], L, R) :- prolog:intersection(T, L, R). +:- op(700, xfx, '=@='). + +prolog:(Term1 =@= Term2) :- + variant(Term1, Term2), !.