Skip to content

Instantly share code, notes, and snippets.

@trietptm
Created December 11, 2012 13:30
Show Gist options
  • Save trietptm/4258577 to your computer and use it in GitHub Desktop.
Save trietptm/4258577 to your computer and use it in GitHub Desktop.
Find out whether a list is a palindrome.
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