Hi all I'm trying to write a lisp function using clisp v2.47 which takes a word and returns true if it is a palindrome otherwise it will return false. By the way whats worth mentioning is that I'm new to lisp so i don't have experience in writing lisp code.
Here is my code:
(defun palindrome( L )
(cond
((equal L '()) T )
((equal (car (L)) (last ( L )))
(palindrome (cdr (reverse (cdr (L))))))
(t nil)))
When I paste it into clisp it is fine but when i come to run it i get this error that i don't know how to fix:
[2]> (setq M '(bob))
(BOB)
[3]> (palindrome M)
*** - EVAL: undefined function L
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead of (FDEFINITION 'L).
RETRY :R2 Retry
STORE-VALUE :R3 Input a new value for (FDEFINITION 'L).
ABORT :R4 Abort main loop
Break 1 [4]>
Any help would be most appreciated as I'm really in a hurry to finish this program.
Thanks all