%=============================================
% Exploring Unification
%
%=============================================

%-----------------------------------
% A variable unifies with any term,
% binding the variable to the term.
%-----------------------------------
:- =(X,1).
:- =(X,foo(bar)).

%------------------------------------------
% Two constants unify only if they are identical
%------------------------------------------
:- =(1,1).
:- =(1,2).

%-----------------------------------
% Compound terms unify only if they have 
%       the same structure and their 
%       elements unify.
%-----------------------------------
:- =(foo(arg1,V),foo(arg1,arg2)).
:- =(F(A1,A2),+(1,2)).

%----------------------------------------
% They unify (have a common instance)
%   but niether is an instance of the other.
%----------------------------------------
:- =(a(1,X),a(Y,1)).

%-----------------------------------
% A list is a special data structure.
% It has a Head (the first element)
%    and a tail (a list comprised by the rest
%    of the elements),
%-----------------------------------
:- =([Head | Tail],[a,b,c,d,e]).
:- =([a,b,c],[Head | [H1 | Tail]]).
