TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
"Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
X-To:
Tom Moran <[log in to unmask]>
Date:
Wed, 19 Apr 2000 14:08:48 -0400
Reply-To:
Steven Deller <[log in to unmask]>
Subject:
MIME-Version:
1.0
Content-Transfer-Encoding:
7bit
Content-Type:
text/plain; charset="us-ascii"
From:
Steven Deller <[log in to unmask]>
Parts/Attachments:
text/plain (27 lines)
On Wednesday, April 19, 2000 1:00 PM, Tom Moran [SMTP:[log in to unmask]] wrote:
> The middle of a palindrome is also a palindrome, so one definition is:
>
> A zero length string is a palindrome.  Anything longer must
> have the first and last letter the same, and the in-between letters
> must be a palindrome.

So are you saying...

function Is_Palindrome (S : String) return Boolean is
begin
    return S = "" or else
             (S (S'First) = S (S'Last) and
               Is_Palindrome (S (Natural'Succ (S'First) .. Natural'Pred
(S'Last))));
end Is_Palindrome;

Regards,
Steve
"E"commerce is not life and death. If it was, it would be coded in Ada.
Steven Deller, Apex Ada Marketing
[log in to unmask], (410) 757 6924
Rational Software Corporation, http://www.rational.com
Apex email groups:  http://www.rational.com/products/apex/usergroups
Apex technical notes:
 http://www.rational.com/sitewide/support/technotes/apex.jtmpl

ATOM RSS1 RSS2