Created
December 11, 2012 13:30
-
-
Save trietptm/4258577 to your computer and use it in GitHub Desktop.
Find out whether a list is a palindrome.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
appendlist([], X, [X]). | |
appendlist([H|T], X, [H|T1]) :- appendlist(T, X, T1). | |
palindrome([]). | |
palindrome([X]). | |
palindrome([X|T]) :- appendlist(L, X, T), palindrome(L). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment