Subject: Re: recursive function that returns true/false (newbie stuff)
From: Erik Naggum <clerik@naggum.no>
Date: 1998/01/25
Newsgroups: comp.lang.lisp
Message-ID: <3094699721088415@naggum.no>


* Kevin Goodier
| My general question: is this the correct way to implement the return
| values for is-palindrome?  Am I returning the correct "booleans" ('T and
| 'NIL), in the correct places, and is the recursive part of this
| implemented efficiently?

  well, (EQUAL LIST (REVERSE LIST)) would be a lot more efficient, as well
  as answering the question right away, although it, too, does two list
  traversals.  can you determine whether a list is palindromatic in one
  pass, or do you need at least two?  how about a vector?  how many passes
  do _you_ make over the list?

  also consider whether "x" is a degenerate palindrome and needs a special
  case, or does it just help efficiency to add one?

#:Erik
-- 
The year "98" was new 1900 years ago.  |  Help fight MULE in GNU Emacs 20!
Be year 2000 compliant, write "1998"!  |  http://sourcery.naggum.no/emacs/