comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <OneWingedShark@gmail.com>
Subject: Re: comparing characters in string
Date: Sun, 05 Oct 2014 05:16:14 -0700
Date: 2014-10-05T05:16:14-07:00	[thread overview]
Message-ID: <iEaYv.324646$DJ7.323625@fx02.iad> (raw)
In-Reply-To: <ly7g0fc7x1.fsf@pushface.org>

On 10/5/2014 12:06 AM, Simon Wright wrote:
> Shark8 <OneWingedShark@gmail.com> writes:
>
>>       function tt (a, b  : in String) return Boolean is
>>         Target    : Character renames a(a'first);
>>         Found     : Constant Boolean:= True;
>>         Substring : constant String:= b(b'first+1..b'last);
>>       begin
>>         return (if (for some Ch of Substring => Ch = Target) then Found
>>                 else not Found);
>>       end tt;
>
> Couldn't that just be
>
>     function tt (a, b  : in String) return Boolean is
>       Target    : Character renames a(a'first);
>       Substring : constant String:= b(b'first+1..b'last);
>     begin
>       return (for some Ch of Substring => Ch = Target);
>     end tt;
>

Yes, but in the original posted code the return-value was false if 
found, true if not.


  reply	other threads:[~2014-10-05 12:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-04 23:03 comparing characters in string Stribor40
2014-10-05  1:41 ` Shark8
2014-10-05  7:06   ` Simon Wright
2014-10-05 12:16     ` Shark8 [this message]
2014-10-05 12:41       ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox