% Write a Prolog program to implement palindrome(List).
% append is the inbuilt function.
palind([]):- write('palindrome').
palind([_]):- write('palindrome').
palind(L) :-
append([H|T], [H], L),
palind(T)
;
write('Not a palindrome').
% Output
 |
Prolog program to implement palindrome(List). |
can you explain what append([H|T], [H], L) is doing? I understand that you're removing the first and last element of the array, but could you break this down
ReplyDelete