I am writing a function called palindrome that tests if a list is a palindrome. It works 100% for regular lists such as (1 2 1), but if I use (1 (2) 1), I get a bad argument type error.
Here is my function
(defun palindrome (x)
(if (NULL x) t
(let ( ( a (car x)) (b (lastelement x)))
(if ( = a b)
(palindrome (cdr (butlast x)))
nil))))