I have a question about how Prolog works. I never studied Prolog, but the time has come to face that language. I searched a piece of code for palindrome check and I found this
pal([]).
pal([_]).
pal(Pal) :-
   append([H|T], [H], Pal),
   pal(T).
For example I call pal([abccba]). and pal([abcdba]).. I understand how it works (it takes the head and the tail - 1 and appends the head to the tail's end). However, I don't understand why when the pal(T) is called with [c, c] the result is true, but when it's called with [c, d] it fails on append?
Can anyone explain to me how it works?