VILL- DEBANDI, AMTA, HOWRAH PIN-711410 Phone-9836357266
Find out whether a list is a palindrome.
my_reverse(L1,L2) :- my_rev(L1,L2,[]).
my_rev([],L2,L2) :- !.
my_rev([X|Xs],L2,Acc) :- my_rev(Xs,L2,[X|Acc]).
is_palindrome(L) :- reverse(L,L).
No comments:
Post a Comment