You are on page 1of 2

PROLOG DIFFERENCE LISTS Q&A VERSION 1.

-
. Q &A
, , . ,
.
?
:
, .
-
. ,

. :
( ,)
Assume we have the lists

L1=[a,b,c,d|Xs] and L2= [e,f,g].

Than we can do Xs=L2.
" " .

?
:
?
. ( )...
( ) . : L ,
.T
iterate(L,T). (T is the last member of L).

?L-T
. ()
?
iterate(L-T).
, .

?T-T
. :
?* . ,
, .
,

.
iterate(][],T-T). % end of L1 -> finish L2

Vitali Pomanitski

PROLOG DIFFERENCE LISTS Q&A VERSION 1.0

?T==L
. , : ?
, .
? , . ,T-T
( ) .
== :
iterate(L-T):- L==T.
- .

Vitali Pomanitski