It seems to me that this will return true for
any string presented. It calls itself with a
smaller and smaller slice of the string until
it makes the <=1 requirement and then returns
a boolean true all the way back up. I put it
into a small example test program and thats
what I seem to get. Am I missing something?


Tony Bartolini ([log in to unmask])

-----Original Message-----
From: Bill Taylor [mailto:[log in to unmask]]
Sent: Thursday, April 20, 2000 3:30 PM
To: [log in to unmask]
Subject: Re: [Off topic] palindromes

An easier to implement alternative is:

A string of length zero or one is a palindrome.  Anything longer must
have the first and last letter the same, and the in-between letters
must be a palindrome.

So again avoiding the issue of punctuation and spaces,

function Is_Palindrome (S : String) return Boolean is
    return S'Length <= 1 or else
               Is_Palindrome (S(Natural'Succ(S'First) ..
end Is_Palindrome;

Bill Taylor ([log in to unmask])