I just started learning Prolog and my task is to write a predicate poklapanje(M,V) which returns yes if all the elements of list M are the first elements of list V, for example poklapanje([1,2],[1,2,3]) should return yes. The first question I have is what is the difference between true and yes, because I am getting true in my solution? Second, when I type poklapanje(X,[1,2,3]) I should get:
X = [];
X = [1];
X = [1,2];
X = [1,2,3];
no
and I get:
X = [];
false
Why? I guess it has something to do with my implementation and printing true/false instead of yes/no.
Here is my code:
poklapanje([],[_|_]).
poklapanje([A|B],[C|D]):- A == C, poklapanje(B,D).