eboats Posted June 20 Share Posted June 20 Hello, I'd like to create a palindrome where I start with ((s -) (e -) (3e = = -e)) and have the output be ((s -) (e -) (3e = = -e) (e -) (s -)) . But the gen-palindrome function doesn't quite do this. Is there a general lisp way of doing this? Quote Link to comment Share on other sites More sharing options...
jesele Posted June 20 Share Posted June 20 This is one way. (setf foo '((s -) (e -) (3e = = -e))) (append foo (cdr (reverse foo))) Or as a function (defun palindrome (lst) (append lst (cdr (reverse lst))) ) (palindrome foo) Jesper Quote Link to comment Share on other sites More sharing options...
eboats Posted June 20 Author Share Posted June 20 Ah, nice thanks much! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.