Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Blinding speed can compensate for a lot of deficiencies. -- David Nichols


devel / comp.lang.ada / Re: Ok - WHAT are those "Maps.Identity" things ???

SubjectAuthor
* Ok - WHAT are those "Maps.Identity" things ???1.AAC0831
+* Re: Ok - WHAT are those "Maps.Identity" things ???Rod Kay
|`* Re: Ok - WHAT are those "Maps.Identity" things ???1.AAC0832
| +- Re: Ok - WHAT are those "Maps.Identity" things ???Gautier write-only address
| +* Re: Ok - WHAT are those "Maps.Identity" things ???Randy Brukardt
| |`* Re: Ok - WHAT are those "Maps.Identity" things ???1.AAC0832
| | `* Re: Ok - WHAT are those "Maps.Identity" things ???Marius Amado-Alves
| |  `- Re: Ok - WHAT are those "Maps.Identity" things ???1.AAC0832
| `* Re: Ok - WHAT are those "Maps.Identity" things ???G.B.
|  `- Re: Ok - WHAT are those "Maps.Identity" things ???1.AAC0832
`* Re: Ok - WHAT are those "Maps.Identity" things ???Jeffrey R.Carter
 `* Re: Ok - WHAT are those "Maps.Identity" things ???1.AAC0832
  `* Re: Ok - WHAT are those "Maps.Identity" things ???Jeffrey R.Carter
   `* Re: Ok - WHAT are those "Maps.Identity" things ???1.AAC0832
    `* Re: Ok - WHAT are those "Maps.Identity" things ???Simon Wright
     `* Re: Ok - WHAT are those "Maps.Identity" things ???1.AAC0832
      `* Re: Ok - WHAT are those "Maps.Identity" things ???Niklas Holsti
       `- Re: Ok - WHAT are those "Maps.Identity" things ???1.AAC0832

1
Ok - WHAT are those "Maps.Identity" things ???

<DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6502&group=comp.lang.ada#6502

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Tue, 04 Jan 2022 18:54:14 -0600
Newsgroups: comp.lang.ada
X-Mozilla-News-Host: news://news.west.earthlink.net:119
From: z24ba6....@nowhere (1.AAC0831)
Subject: Ok - WHAT are those "Maps.Identity" things ???
Date: Tue, 4 Jan 2022 19:54:08 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
Thunderbird/68.12.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Message-ID: <DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com>
Lines: 64
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 98.77.165.67
X-Trace: sv3-EZnu65s9PxAf1K6ngD0BmagfWvrycLGGCunKAceEV8SABDZobJ4+N8Fr8mCZkXPcyljjObgdQRdlh9s!FUEGHuZ+lejniG1H7WSntPL+fi/oK3zVfzkj/XGU5+mT330CYxORGQY0MdRgACPY1HknM4IQOu3m!AJFhPqbJV5jktVu8nfs=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 3935
 by: 1.AAC0831 - Wed, 5 Jan 2022 00:54 UTC

I'll try to squeeze in between the "Hot Lezbo Action" spam ...

Ok ... ADA online documentation is POOR. Lots of
definitions, often NO practical examples of even
the simplest things. You'd expect more for an
"official DOD" language.

Problem : I want to find out if/where a substring
is in another string (lets assume unbounded strings).

The docs say to use Index(source,substr,<something>,<something-identity>)

Well, I can guess what the first two are. The third probably
is "forward" or maybe '1' for "start at first'. However all
examples of Index have some kind of mapping param for #4
and I've used every search engine and CANNOT figure out what
goes in there.

Sure, I can take progressive slices of the source and compare
them to the substring - the HARD old-fashioned way - but so
long as there's a library function I'd like to know how
to USE the thing. Not a single comprehensible example in
the whole world. There are a lot of string-related functions
that look useful, and most use this mystery 'mapping' thing.
Oh yea, just doing x:=Index(src,sub) generates a "no
candidates" error in Gnat.

I just finished a sort of managed list thing for text
files that sort of does what FPC tStringList can do.
Linked-list of named stringlists and vital params and
access (pointers) to another linked list that actually
holds the text strings. Advantage ... you don't have to
know how many lines are in the text file - could be
one, could be a million, so you don't have to guess
about the size of the holding array. If you need to
use several named lists just add something to that name
and it sets itself up.

All that works fine. The very last thing I wanted to
add was a "is substring in string" function - might
return a boolean, but I might cheat and return a real
with the listindex .point. position-in-str sort of format.

Thought I should learn some Ada "just because". It's a
very picky language. I suppose that makes it "safer"
but come ON now ! I want to escape to good old 'C'
and Pascal now (actually I've changed most of my Python
apps over to FPC/Delphi of late because interpreted
languages are awkward unless you use Cython or something
to turn 'em into executables. Alas no matter what you
do they are STILL kinda hostage to the exact version
of Python on the machine ............

Anyway, yes, some people ARE still interested in some
of these "old" computer languages. I even wrote a little
FORTRAN pgm, first I'd done in like 30+ years. The newer
versions ARE easier than the old "this goes in THIS
column, that goes in THAT column" :-) Algol68 is
underdocumented (and kinda weird) and the current GM2
modula-2 in the linux repos doesn't seem to work as
advertized (haven't quite got the modula-3 compiler
up and going yet, but I WILL).

Re: Ok - WHAT are those "Maps.Identity" things ???

<sr3bi3$fu2$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6503&group=comp.lang.ada#6503

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: rodak...@gmail.com (Rod Kay)
Newsgroups: comp.lang.ada
Subject: Re: Ok - WHAT are those "Maps.Identity" things ???
Date: Wed, 5 Jan 2022 16:49:51 +1100
Organization: A noiseless patient Spider
Lines: 63
Message-ID: <sr3bi3$fu2$1@dont-email.me>
References: <DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 5 Jan 2022 05:49:56 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="8e2cbfa1b5b2277c2f4af20f4b51d6b5";
logging-data="16322"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19sj4NZB4EGpREVBhob/dXEagJNbHpRKgs="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
Cancel-Lock: sha1:+06PLp9JOrtNNxw2Ygkwt7e95uA=
In-Reply-To: <DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com>
Content-Language: en-US
 by: Rod Kay - Wed, 5 Jan 2022 05:49 UTC

On 5/1/22 11:54 am, 1.AAC0831 wrote:
>
> Ok ... ADA online documentation is POOR. Lots of
> definitions, often NO practical examples of even
> the simplest things. You'd expect more for an
> "official DOD" language.
>

With a duckduckgo search on "ada string index", the first hit is ...

https://learn.adacore.com/courses/intro-to-ada/chapters/standard_library_strings.html

.... which provides a simple example of the 'Index' function.

> Problem : I want to find out if/where a substring
> is in another string (lets assume unbounded strings).
>
> The docs say to use Index(source,substr,<something>,<something-identity>)
>
> Well, I can guess what the first two are. The third probably
> is "forward" or maybe '1' for "start at first'. However all
> examples of Index have some kind of mapping param for #4
> and I've used every search engine and CANNOT figure out what
> goes in there.

https://www.adaic.org/resources/add_content/standards/05rm/html/RM-A-4-2.html

https://www.adaic.org/resources/add_content/standards/05rm/html/RM-A-4-3.html

In many/most cases, the default parameters for 'Mapping' are fine.

> All that works fine. The very last thing I wanted to
> add was a "is substring in string" function - might
> return a boolean, but I might cheat and return a real
> with the listindex .point. position-in-str sort of format.
>

function Contains (Source : in String; Pattern : in String)
return Boolean
is
use Ada.Strings.Fixed;
begin
return Index (Source, Pattern) /= 0;
end Contains;

In summary, Ada is one of the the best documented languages in
existence. Consider the excellent 'Language Reference Manual', the 'Ada
Rationale's and the 'Ada Quality and Style Guide's.

Furthermore the resources at 'https://learn.adacore.com' and
'https://www.adacore.com/gems' provide many examples of best practices
in specific areas of interest.

Finally, forums such as 'comp.lang.ada' and the '#ada' irc channel
on the 'irc.libera.chat' server are great places to quickly find answers.

Regards.

Re: Ok - WHAT are those "Maps.Identity" things ???

<sr44qc$i68$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6504&group=comp.lang.ada#6504

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: spam.jrc...@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: Ok - WHAT are those "Maps.Identity" things ???
Date: Wed, 5 Jan 2022 14:01:00 +0100
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <sr44qc$i68$1@dont-email.me>
References: <DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 5 Jan 2022 13:01:00 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="72c8f5af9551dff889df858b220ff646";
logging-data="18632"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+pZcP0z2NBDnJ+i/9S6FDunAXbxIfkRVg="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.3.1
Cancel-Lock: sha1:RZB0MG+obHBcCdVIokRvnhNXSms=
In-Reply-To: <DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com>
Content-Language: en-US
 by: Jeffrey R.Carter - Wed, 5 Jan 2022 13:01 UTC

On 2022-01-05 01:54, 1.AAC0831 wrote:
>
> The docs say to use Index(source,substr,<something>,<something-identity>)

I don't know what "docs" you mean. Anyone using Ada should be familiar with its
standard library, which is documented in Annex A of the ARM at

http://www.ada-auth.org/standards/aarm12_w_tc1/html/AA-A.html

(I provide the link to the AARM as the annotations are sometimes useful.)

The documentation for Ada.Strings.Fixed is at

http://www.ada-auth.org/standards/aarm12_w_tc1/html/AA-A-4-3.html

and lists 6 functions named Index (and 2 for Index_Non_Blank). Of these I mostly
use the one at paragraph 9:

9 function Index (Source : in String;
Pattern : in String;
Going : in Direction := Forward;
Mapping : in Maps.Character_Mapping
:= Maps.Identity)
return Natural;

with the defaults for the last 2 parameters. Occasionally I've used a Going =>
Backward,

The Mapping/Test parameters are for specialized needs, such as case-insensitive
matching or folding accented characters together, and the default will work if
you don't need anything like that.

--
Jeff Carter
"When and now is this guitar piece from Stottlemeyer?
Yes, it's with Mr. Dog in Gertrude's pinball forest."
The World's Funniest Joke
133

Re: Ok - WHAT are those "Maps.Identity" things ???

<AOmdnX_3T5ObO0r8nZ2dnUU7-IHNnZ2d@earthlink.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6511&group=comp.lang.ada#6511

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Thu, 06 Jan 2022 20:31:34 -0600
Subject: Re: Ok - WHAT are those "Maps.Identity" things ???
Newsgroups: comp.lang.ada
References: <DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com>
<sr3bi3$fu2$1@dont-email.me>
From: z24ba7....@nowhere (1.AAC0832)
Date: Thu, 6 Jan 2022 21:31:33 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
Thunderbird/68.12.0
MIME-Version: 1.0
In-Reply-To: <sr3bi3$fu2$1@dont-email.me>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Message-ID: <AOmdnX_3T5ObO0r8nZ2dnUU7-IHNnZ2d@earthlink.com>
Lines: 104
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 98.77.165.67
X-Trace: sv3-EET3+qSSJoybR8aW95XxDbJ4YOdSGiY+vHbX6BpwBwaTgwlDFMd90tNhFWmqze9r6ywioWR5CaPOiOw!Css48xW8QZx/LmYbvJhq2BVQT/manKS8JL6vMwKf3aZ3nAckMWWx8u9F3FLJpM3WJ8ZDbUFlHdAL!sXnTu/x0o42t7ayi4qA=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 4748
 by: 1.AAC0832 - Fri, 7 Jan 2022 02:31 UTC

On 1/5/22 12:49 AM, Rod Kay wrote:
> On 5/1/22 11:54 am, 1.AAC0831 wrote:
>>
>> Ok ... ADA online documentation is POOR. Lots of
>> definitions, often NO practical examples of even
>> the simplest things. You'd expect more for an
>> "official DOD" language.
>>
>
> With a duckduckgo search on "ada string index", the first hit is ...
>
> https://learn.adacore.com/courses/intro-to-ada/chapters/standard_library_strings.html

Gnat wants FOUR params ... and it's the last "map" related
one that's most mysterious. I'd also seen examples using
only TWO params ... but the compiler balks.

In any case :
Idx := Index
(Source => S,
Pattern => P,
From => Idx + 1);

won't compile no matter what you put in "from".

Oh well, I actually wrote my own. It works just fine
and I was able to finish what I had in mind. Progressive
slices of the source string compared against the "needle"
string with "unbounded_slice" as the cutter-upper. DID
do a quick pre-scan to see if at least the first char of
the needle appears in the source and where. We start
slicing from there, which saves iterations.

> ... which provides a simple example of the 'Index' function.
>
>
>> Problem : I want to find out if/where a substring
>> is in another string (lets assume unbounded strings).
>>
>> The docs say to use Index(source,substr,<something>,<something-identity>)
>>
>> Well, I can guess what the first two are. The third probably
>> is "forward" or maybe '1' for "start at first'. However all
>> examples of Index have some kind of mapping param for #4
>> and I've used every search engine and CANNOT figure out what
>> goes in there.
>
>
> https://www.adaic.org/resources/add_content/standards/05rm/html/RM-A-4-2.html
>
>
> https://www.adaic.org/resources/add_content/standards/05rm/html/RM-A-4-3.html
>
>
>    In many/most cases, the default parameters for 'Mapping' are fine.
>
>
>> All that works fine. The very last thing I wanted to
>> add was a "is substring in string" function - might
>> return a boolean, but I might cheat and return a real
>> with the listindex .point. position-in-str sort of format.
>>
>
> function Contains (Source : in String;   Pattern : in String)
> return Boolean
> is
>    use Ada.Strings.Fixed;
> begin
>    return Index (Source, Pattern) /= 0;
> end Contains;>

None of my strings are fixed. Those get "stuck" in
size the first time you assign them and are mostly
useless IMHO. Tried to use the library with "to_string()"
but still no joy.

Anyway, thanks for the input - I'll try a few suggested
variations from your docs. For now though it's back to
Lazarus/FPC for a different practical project - the
kind they pay you for :-)

I'm not gonna buy $100 books for a language I was only
curious about. Adaic seems to have some fair online
info though.

>    In summary, Ada is one of the the best documented languages in
> existence. Consider the 'Language Reference Manual', the 'Ada
> Rationale's and the 'Ada Quality and Style Guide's.
>
>    Furthermore the resources at 'https://learn.adacore.com' and
> 'https://www.adacore.com/gems' provide many examples of best practices
> in specific areas of interest.
>
>    Finally, forums such as 'comp.lang.ada' and the '#ada' irc channel
> on the 'irc.libera.chat' server are great places to quickly find answers.
>
>
> Regards.

Re: Ok - WHAT are those "Maps.Identity" things ???

<WcidnROWEIzHNUr8nZ2dnUU7-b3NnZ2d@earthlink.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6512&group=comp.lang.ada#6512

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!buffer1.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Thu, 06 Jan 2022 20:41:30 -0600
Subject: Re: Ok - WHAT are those "Maps.Identity" things ???
Newsgroups: comp.lang.ada
References: <DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com>
<sr44qc$i68$1@dont-email.me>
From: z24ba7....@nowhere (1.AAC0832)
Date: Thu, 6 Jan 2022 21:41:24 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
Thunderbird/68.12.0
MIME-Version: 1.0
In-Reply-To: <sr44qc$i68$1@dont-email.me>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Message-ID: <WcidnROWEIzHNUr8nZ2dnUU7-b3NnZ2d@earthlink.com>
Lines: 51
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 98.77.165.67
X-Trace: sv3-6yG4bX+PpBX/9fPcDLzQ5uU3++oJEhNS9R/s1GrtPI0Nqn4qsOGeshCR73yCWNNAK+Zm/ecq6nUM+vy!fHEn3EVVnblH+3Jwa3QVuSGCpCFHI9TXIOWJ4x8EwrzeKQyLV3A0kwDwP8ami14K5J2+bEaByAFX!YeCzBBIIbocPznYTWfQ=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 3346
 by: 1.AAC0832 - Fri, 7 Jan 2022 02:41 UTC

On 1/5/22 8:01 AM, Jeffrey R.Carter wrote:
> On 2022-01-05 01:54, 1.AAC0831 wrote:
>>
>> The docs say to use Index(source,substr,<something>,<something-identity>)
>
> I don't know what "docs" you mean. Anyone using Ada should be familiar
> with its standard library, which is documented in Annex A of the ARM at
>
> http://www.ada-auth.org/standards/aarm12_w_tc1/html/AA-A.html
>
> (I provide the link to the AARM as the annotations are sometimes useful.)
>
> The documentation for Ada.Strings.Fixed is at
>
> http://www.ada-auth.org/standards/aarm12_w_tc1/html/AA-A-4-3.html
>
> and lists 6 functions named Index (and 2 for Index_Non_Blank). Of these
> I mostly use the one at paragraph 9:
>
> 9  function Index (Source   : in String;
>                    Pattern  : in String;
>                    Going    : in Direction := Forward;
>                    Mapping  : in Maps.Character_Mapping
>                                 := Maps.Identity)
>       return Natural;
>
> with the defaults for the last 2 parameters. Occasionally I've used a
> Going => Backward,

I'm using unbounded strings and there's a version in
that library with the same params - but Gnat seems
to DEMAND the last two params. Might try the fixed
library by casting my unbounded to string ...

Anyway, in frustration I just wrote my own. Works good
and I was able to finish what I wanted to do.

> The Mapping/Test parameters are for specialized needs, such as
> case-insensitive matching or folding accented characters together, and
> the default will work if you don't need anything like that.

I've been programming since a tad before the dawn of the
Apples and Commodores - punch cards and serial terminals
wired to the mini-mainframe, FORTRAN, COBOL, that horrible
stuff. For some reason I just can't grock a lot of the Ada
docs. Lots and lots of DESCRIPTIONS about how to do things
but a "picture" is worth a thousand words ...

But I really really like Pascal better.

Re: Ok - WHAT are those "Maps.Identity" things ???

<d2377398-6a4b-4ad3-8e27-2aa14ebe81a4n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6513&group=comp.lang.ada#6513

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:2269:: with SMTP id gs9mr2721013qvb.40.1641526764099;
Thu, 06 Jan 2022 19:39:24 -0800 (PST)
X-Received: by 2002:a25:aa8c:: with SMTP id t12mr63802211ybi.615.1641526763870;
Thu, 06 Jan 2022 19:39:23 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Thu, 6 Jan 2022 19:39:23 -0800 (PST)
In-Reply-To: <AOmdnX_3T5ObO0r8nZ2dnUU7-IHNnZ2d@earthlink.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a02:1206:4596:5040:f9d5:7d39:8abd:a5ab;
posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG
NNTP-Posting-Host: 2a02:1206:4596:5040:f9d5:7d39:8abd:a5ab
References: <DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com>
<sr3bi3$fu2$1@dont-email.me> <AOmdnX_3T5ObO0r8nZ2dnUU7-IHNnZ2d@earthlink.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d2377398-6a4b-4ad3-8e27-2aa14ebe81a4n@googlegroups.com>
Subject: Re: Ok - WHAT are those "Maps.Identity" things ???
From: gautier_...@hotmail.com (Gautier write-only address)
Injection-Date: Fri, 07 Jan 2022 03:39:24 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 13
 by: Gautier write-only a - Fri, 7 Jan 2022 03:39 UTC

> > https://learn.adacore.com/courses/intro-to-ada/chapters/standard_library_strings.html
> Gnat wants FOUR params ... and it's the last "map" related
> one that's most mysterious. I'd also seen examples using
> only TWO params ... but the compiler balks.
>
> In any case :
> Idx := Index
> (Source => S,
> Pattern => P,
> From => Idx + 1);
>
> won't compile no matter what you put in "from".

Uh? Do you see the big "Run" button on the Web site mentioned above? Click on it!

Re: Ok - WHAT are those "Maps.Identity" things ???

<sr8emg$u51$1@franka.jacob-sparre.dk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6514&group=comp.lang.ada#6514

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!paganini.bofh.team!newsfeed.xs3.de!callisto.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail
From: ran...@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: Ok - WHAT are those "Maps.Identity" things ???
Date: Thu, 6 Jan 2022 22:14:06 -0600
Organization: JSA Research & Innovation
Lines: 37
Message-ID: <sr8emg$u51$1@franka.jacob-sparre.dk>
References: <DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com> <sr3bi3$fu2$1@dont-email.me> <AOmdnX_3T5ObO0r8nZ2dnUU7-IHNnZ2d@earthlink.com>
Injection-Date: Fri, 7 Jan 2022 04:14:08 -0000 (UTC)
Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226";
logging-data="30881"; mail-complaints-to="news@jacob-sparre.dk"
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
 by: Randy Brukardt - Fri, 7 Jan 2022 04:14 UTC

"1.AAC0832" <z24ba7.net> wrote in message
news:AOmdnX_3T5ObO0r8nZ2dnUU7-IHNnZ2d@earthlink.com...
....
> Gnat wants FOUR params ... and it's the last "map" related
> one that's most mysterious. I'd also seen examples using
> only TWO params ... but the compiler balks.
>
> In any case :
> Idx := Index
> (Source => S,
> Pattern => P,
> From => Idx + 1);
>
> won't compile no matter what you put in "from".

I use this sort of thing all the time (especially in the Trash-Finder spam
filter), and it works fine. You never have to give the 4th parameter in
these routines as they have a defined default which allows you to omit them.
So it's highly likely that you've done something else wrong which is why
nothing you try works.

But you've given so little detail about your program, it's impossible to
help. Ada resolution can be finiky, especially when a routine is overloaded
as Index is, and that is also the case where it is difficult/impossible for
a compiler to give an understandable error message. To get useful help
around here, you need to provide a complete example (including all of the
declarations and use clauses and with clauses). Otherwise, it just ends up
being griping and people will tune you out.

For instance, in the above, I have no idea what types S, P, and Idx have --
and that matters a lot -- Ada is a very strongly typed language.

Randy.

Re: Ok - WHAT are those "Maps.Identity" things ???

<sr92c3$ovp$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6515&group=comp.lang.ada#6515

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: spam.jrc...@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: Ok - WHAT are those "Maps.Identity" things ???
Date: Fri, 7 Jan 2022 10:49:54 +0100
Organization: A noiseless patient Spider
Lines: 49
Message-ID: <sr92c3$ovp$1@dont-email.me>
References: <DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com>
<sr44qc$i68$1@dont-email.me> <WcidnROWEIzHNUr8nZ2dnUU7-b3NnZ2d@earthlink.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 7 Jan 2022 09:49:55 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="05fd67cb75ba5878beecc9e388dfee63";
logging-data="25593"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+3OrS4HPBixSKnXG8JqEpwFP8dM+JzXUs="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.3.1
Cancel-Lock: sha1:SWmi1UxdVHUD0Ny6c1lGhd8MxJA=
In-Reply-To: <WcidnROWEIzHNUr8nZ2dnUU7-b3NnZ2d@earthlink.com>
Content-Language: en-US
 by: Jeffrey R.Carter - Fri, 7 Jan 2022 09:49 UTC

On 2022-01-07 03:41, 1.AAC0832 wrote:
>>
>> and lists 6 functions named Index (and 2 for Index_Non_Blank). Of these I
>> mostly use the one at paragraph 9:
>>
>> 9  function Index (Source   : in String;
>>                     Pattern  : in String;
>>                     Going    : in Direction := Forward;
>>                     Mapping  : in Maps.Character_Mapping
>>                                  := Maps.Identity)
>>        return Natural;
>>
>> with the defaults for the last 2 parameters. Occasionally I've used a Going =>
>> Backward,
>
>
>   I'm using unbounded strings and there's a version in
>   that library with the same params - but Gnat seems
>   to DEMAND the last two params. Might try the fixed
>   library by casting my unbounded to string ...

I missed that detail in your original msg. Ada.Strings.Unbounded (ARM A.4.5) has
similar Index functions, but note that Source is Unbounded_String and Pattern is
String. As Brukardt said, without more detail we can't tell what is really going
on, but my experience is that GNAT will not require defaulted parameters. More
likely GNAT is trying to do overload resolution when there is no visible
subprogram that matches the parameters you are passing; the resulting error msgs
are not clear.

Experienced Ada users find that Unbounded_String is needed a lot less than is
expected by people coming from languages where strings are magic. Unless you
need data structures with varying-length strings, you don't often need them.

>   I've been programming since a tad before the dawn of the
>   Apples and Commodores - punch cards and serial terminals
>   wired to the mini-mainframe, FORTRAN, COBOL, that horrible
>   stuff. For some reason I just can't grock a lot of the Ada
>   docs. Lots and lots of DESCRIPTIONS about how to do things
>   but a "picture" is worth a thousand words ...

I also started out with FORTRAN-66 on punched cards, but my experience is the
opposite: Ada (without the features that were mistakes) supports very well the
way I engineer S/W.

--
Jeff Carter
"Hello! Smelly English K...niggets."
Monty Python & the Holy Grail
08

Re: Ok - WHAT are those "Maps.Identity" things ???

<sr99al$avk$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6516&group=comp.lang.ada#6516

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: bauh...@notmyhomepage.invalid (G.B.)
Newsgroups: comp.lang.ada
Subject: Re: Ok - WHAT are those "Maps.Identity" things ???
Date: Fri, 7 Jan 2022 12:48:36 +0100
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <sr99al$avk$1@dont-email.me>
References: <DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com>
<sr3bi3$fu2$1@dont-email.me> <AOmdnX_3T5ObO0r8nZ2dnUU7-IHNnZ2d@earthlink.com>
Reply-To: nonlegitur@notmyhomepage.de
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 7 Jan 2022 11:48:37 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="8f530c1108a8e7ceadbf1b1e17c5b30d";
logging-data="11252"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+QwQvkxvegIhRkExGjNMSeseO6/BkZAYY="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0)
Gecko/20100101 Thunderbird/91.4.1
Cancel-Lock: sha1:lL6SE+3krs4PrCJIN0o4PkzffG4=
In-Reply-To: <AOmdnX_3T5ObO0r8nZ2dnUU7-IHNnZ2d@earthlink.com>
Content-Language: en-US
 by: G.B. - Fri, 7 Jan 2022 11:48 UTC

On 07.01.22 03:31, 1.AAC0832 wrote:

>   Gnat wants FOUR params ... and it's the last "map" related
>   one that's most mysterious. I'd also seen examples using
>   only TWO params ... but the compiler balks.
>
>   In any case :
>   Idx := Index
>         (Source  => S,
>          Pattern => P,
>          From    => Idx + 1);
>
>   won't compile no matter what you put in "from".

In case you use the opaque type Unbounded_String everywhere,
and then the Index function, it is documented to want a String,
not an Unbounded_String for the Pattern. So, if that's the case,
get a normal (fixes size array) String from an Unbounded_String
object first.

with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;

function pos2 (hay_stack : Unbounded_String; needle : Unbounded_String)
return Natural
is
result : Natural;
begin
result := Index (Source => hay_stack,
Pattern => To_String(needle),
From => 2);
return result;
end pos2;

Re: Ok - WHAT are those "Maps.Identity" things ???

<ULidnZpWIOC2J0b8nZ2dnUU7-Q_NnZ2d@earthlink.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6523&group=comp.lang.ada#6523

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Sun, 09 Jan 2022 22:46:34 -0600
Subject: Re: Ok - WHAT are those "Maps.Identity" things ???
Newsgroups: comp.lang.ada
References: <DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com>
<sr44qc$i68$1@dont-email.me> <WcidnROWEIzHNUr8nZ2dnUU7-b3NnZ2d@earthlink.com>
<sr92c3$ovp$1@dont-email.me>
From: z24ba7....@nowhere (1.AAC0832)
Date: Sun, 9 Jan 2022 23:46:34 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
Thunderbird/68.12.0
MIME-Version: 1.0
In-Reply-To: <sr92c3$ovp$1@dont-email.me>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Message-ID: <ULidnZpWIOC2J0b8nZ2dnUU7-Q_NnZ2d@earthlink.com>
Lines: 96
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 98.77.165.67
X-Trace: sv3-mSyRca7QII+pjcXbTNgqRdIp2K4MChFqwrp32/ftK7H+ilEJUsMqJfoKLiAvGxNr23zWDItrAxr08H+!vfZGDuK6tFinM6k00aErMg68tZGCM3R23PA4hUBG31sjpaMlio17J9uHHh3s2weNezfNvhIGQLlc!GsLcYlMWfhj4epmShyY=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 5664
 by: 1.AAC0832 - Mon, 10 Jan 2022 04:46 UTC

On 1/7/22 4:49 AM, Jeffrey R.Carter wrote:
> On 2022-01-07 03:41, 1.AAC0832 wrote:
>>>
>>> and lists 6 functions named Index (and 2 for Index_Non_Blank). Of
>>> these I mostly use the one at paragraph 9:
>>>
>>> 9  function Index (Source   : in String;
>>>                     Pattern  : in String;
>>>                     Going    : in Direction := Forward;
>>>                     Mapping  : in Maps.Character_Mapping
>>>                                  := Maps.Identity)
>>>        return Natural;
>>>
>>> with the defaults for the last 2 parameters. Occasionally I've used a
>>> Going => Backward,
>>
>>
>>    I'm using unbounded strings and there's a version in
>>    that library with the same params - but Gnat seems
>>    to DEMAND the last two params. Might try the fixed
>>    library by casting my unbounded to string ...
>
> I missed that detail in your original msg. Ada.Strings.Unbounded (ARM
> A.4.5) has similar Index functions, but note that Source is
> Unbounded_String and Pattern is String. As Brukardt said, without more
> detail we can't tell what is really going on, but my experience is that
> GNAT will not require defaulted parameters. More likely GNAT is trying
> to do overload resolution when there is no visible subprogram that
> matches the parameters you are passing; the resulting error msgs are not
> clear.

Hmmmm .... I *may* be using another unbounded for the "needle".
I'll have to check that. Maybe it's not upset about the last
two params, but the unbounded needle !

DID write my own function to accomplish the task - one that
uses unbounded for everything. Works fine. But if a standard
library function can do it ...

> Experienced Ada users find that Unbounded_String is needed a lot less
> than is expected by people coming from languages where strings are
> magic. Unless you need data structures with varying-length strings, you
> don't often need them.

Having to re-DECLARE fixed strings over and over, and
deeper and deeper if you need nested logic, is just
unbearable. It's UGLY.

But I wanted to learn a little Ada ...

>>    I've been programming since a tad before the dawn of the
>>    Apples and Commodores - punch cards and serial terminals
>>    wired to the mini-mainframe, FORTRAN, COBOL, that horrible
>>    stuff. For some reason I just can't grock a lot of the Ada
>>    docs. Lots and lots of DESCRIPTIONS about how to do things
>>    but a "picture" is worth a thousand words ...
>
> I also started out with FORTRAN-66 on punched cards, but my experience
> is the opposite: Ada (without the features that were mistakes) supports
> very well the way I engineer S/W.

Different people find different languages just click
with the way they think. If it's Ada for you, fine,
you should be able to accomplish most anything you
need to do. 'C' and Pascal are more in my way of
thinking. Did learn Python quite well - but I don't
use classes.

But if you want a buzz ... assembler -) Way back in
at the dawn of the home computer era I knew this guy,
classic so-smart-he-was-crazy type, who made a living
re-writing commercial video game cartridges. He
wrote everything on a PET ML monitor - in BINARY -
before burning it to cartridges. Said it gave him a buzz.

I'll do asssembler for PICs/8051s/etc but not much binary
unless it's to set flag groups.

I think the human brain really can't handle anything much
above the IQ-160 level. After that, one gain requires the
loss of some other function. The aforementioned guy, I'd
put him right around IQ-200, and he was NOT "right".

In any case, thanks for the input. This group is so packed
with spam that I wondered if anybody real still used it.
I consider Ada "important" enough to know something about.
Heh ... though my new Pascal project - have been using
double-quoted string constants and "&" instead of "+"
rather often :-)

Wanted to do Modula-2/3 experiments - but GNU GM2 isn't
right on the current distros and throws all kinds of
errors even with "Hello World". Found an M3 compiler
but it's going to need some tuning-in.

Re: Ok - WHAT are those "Maps.Identity" things ???

<ULidnZVWIOBOJ0b8nZ2dnUU7-Q-dnZ2d@earthlink.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6524&group=comp.lang.ada#6524

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!buffer1.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Sun, 09 Jan 2022 22:49:23 -0600
Subject: Re: Ok - WHAT are those "Maps.Identity" things ???
Newsgroups: comp.lang.ada
References: <DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com>
<sr3bi3$fu2$1@dont-email.me> <AOmdnX_3T5ObO0r8nZ2dnUU7-IHNnZ2d@earthlink.com>
<sr99al$avk$1@dont-email.me>
From: z24ba7....@nowhere (1.AAC0832)
Date: Sun, 9 Jan 2022 23:49:23 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
Thunderbird/68.12.0
MIME-Version: 1.0
In-Reply-To: <sr99al$avk$1@dont-email.me>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Message-ID: <ULidnZVWIOBOJ0b8nZ2dnUU7-Q-dnZ2d@earthlink.com>
Lines: 40
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 98.77.165.67
X-Trace: sv3-lz6ojfav4mJFhCrWKKFX16Sf/DXWSHzYeT42pFP1bAT79mLZsFpxYZ4M6GlgT0Uz7UGjwMgBYxN6Qbo!jr3NxS+bZR3X0a6LpXu+aWzCWqs/LI/Jy5RCrFd4PbsxvpyyHqzYg2qC3ikgA+9D48YvY08BOV7R!hRvemhl1Dkg5BIuPhQA=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 2617
 by: 1.AAC0832 - Mon, 10 Jan 2022 04:49 UTC

On 1/7/22 6:48 AM, G.B. wrote:
> On 07.01.22 03:31, 1.AAC0832 wrote:
>
>>    Gnat wants FOUR params ... and it's the last "map" related
>>    one that's most mysterious. I'd also seen examples using
>>    only TWO params ... but the compiler balks.
>>
>>    In any case :
>>    Idx := Index
>>          (Source  => S,
>>           Pattern => P,
>>           From    => Idx + 1);
>>
>>    won't compile no matter what you put in "from".
>
> In case you use the opaque type Unbounded_String everywhere,
> and then the Index function, it is documented to want a String,
> not an Unbounded_String for the Pattern. So, if that's the case,
> get a normal (fixes size array) String from an Unbounded_String
> object first.
>
> with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
>
> function pos2 (hay_stack : Unbounded_String; needle : Unbounded_String)
>   return Natural
> is
>    result : Natural;
> begin
>    result := Index (Source  => hay_stack,
>                     Pattern => To_String(needle),
>                     From    => 2);
>    return result;
> end pos2;

I'll try it as writ.

Someone else said the "needle" is a straight-up STRING
however ... and I'd been sending an unbounded.

Re: Ok - WHAT are those "Maps.Identity" things ???

<QsSdnadOQ8MVXUb8nZ2dnUU7-I3NnZ2d@earthlink.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6525&group=comp.lang.ada#6525

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Sun, 09 Jan 2022 23:13:44 -0600
Subject: Re: Ok - WHAT are those "Maps.Identity" things ???
Newsgroups: comp.lang.ada
References: <DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com>
<sr3bi3$fu2$1@dont-email.me> <AOmdnX_3T5ObO0r8nZ2dnUU7-IHNnZ2d@earthlink.com>
<sr8emg$u51$1@franka.jacob-sparre.dk>
From: z24ba7....@nowhere (1.AAC0832)
Date: Mon, 10 Jan 2022 00:13:43 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
Thunderbird/68.12.0
MIME-Version: 1.0
In-Reply-To: <sr8emg$u51$1@franka.jacob-sparre.dk>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Message-ID: <QsSdnadOQ8MVXUb8nZ2dnUU7-I3NnZ2d@earthlink.com>
Lines: 69
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 98.77.165.67
X-Trace: sv3-J1obH4Zspvg+Ag56oPIyQcXfKWh89U9wdtaX9xrsCJqQc+OvkArZfmaRiM3kdosYvQUS+Z2mGPd8BYM!RToJcQRbo2PcQ6pBwet8FC0NRJIYfsSi3AmYwrHlFaVpPkXXpjHNgZ+wq0tTKLfhihYUi/x4i2+t!lyhDPE3Whc8Ze4DT0bI=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 4367
 by: 1.AAC0832 - Mon, 10 Jan 2022 05:13 UTC

On 1/6/22 11:14 PM, Randy Brukardt wrote:
> "1.AAC0832" <z24ba7.net> wrote in message
> news:AOmdnX_3T5ObO0r8nZ2dnUU7-IHNnZ2d@earthlink.com...
> ...
>> Gnat wants FOUR params ... and it's the last "map" related
>> one that's most mysterious. I'd also seen examples using
>> only TWO params ... but the compiler balks.
>>
>> In any case :
>> Idx := Index
>> (Source => S,
>> Pattern => P,
>> From => Idx + 1);
>>
>> won't compile no matter what you put in "from".
>
> I use this sort of thing all the time (especially in the Trash-Finder spam
> filter), and it works fine. You never have to give the 4th parameter in
> these routines as they have a defined default which allows you to omit them.
> So it's highly likely that you've done something else wrong which is why
> nothing you try works.
>
> But you've given so little detail about your program, it's impossible to
> help. Ada resolution can be finiky, especially when a routine is overloaded
> as Index is, and that is also the case where it is difficult/impossible for
> a compiler to give an understandable error message. To get useful help
> around here, you need to provide a complete example (including all of the
> declarations and use clauses and with clauses). Otherwise, it just ends up
> being griping and people will tune you out.
>
> For instance, in the above, I have no idea what types S, P, and Idx have --
> and that matters a lot -- Ada is a very strongly typed language.
>
> Randy.

Yes ... VERY :-)

Hate typing long things ... made one-liners S2U() and
U2S() if you can guess what those are :-)

Unfortunately Gnat often gives rather generic, useless,
error messages. Not helpful. SOMETHING is wrong, but WHAT ?
You'd swear it was a Microsoft product ..........

Someone else here says that with unbounded searching the
"needle" is a straight-up string, not an unbounded. I'll
have to experiment.

Anyway, thanks for the help. This group has so much spam
I wondered if there were any real programmers here. Ada
is worth knowing something about.

Did get my fancy linked-list of linked-lists setup to
work correctly though :-) Had to write my own string-in-string
finder alas. But, more experiments are warranted. Still
wish those last two params had better docs ... they are
in rather a lot of library functions related to unboundeds.
It's kind a "Why, EVERYONE JUST KNOWS" thing ...

ANYway ... I like experiments. Some Ada is worth knowing.
Set up CP/M-86 on a VM recently and found an Aztec 'C'
compiler for it - retro FUN ! All work and no play ....

Oh, speaking of docs, that Aztec compiler docs were clearly
NOT written by some hired "technical writer" but by the
people who were hands-on writing the compiler. PAGES on
how binary stuff got set up, and how various compiler
flags could affect it. Memory and speed were PRECIOUS
back then ....

Re: Ok - WHAT are those "Maps.Identity" things ???

<9e90006a-59f4-40fb-8b0f-ef5f957d3d86n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6526&group=comp.lang.ada#6526

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:622a:4c7:: with SMTP id q7mr13737385qtx.226.1641809947913;
Mon, 10 Jan 2022 02:19:07 -0800 (PST)
X-Received: by 2002:a5b:60e:: with SMTP id d14mr10856532ybq.31.1641809947723;
Mon, 10 Jan 2022 02:19:07 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Mon, 10 Jan 2022 02:19:07 -0800 (PST)
In-Reply-To: <QsSdnadOQ8MVXUb8nZ2dnUU7-I3NnZ2d@earthlink.com>
Injection-Info: google-groups.googlegroups.com; posting-host=94.60.27.164; posting-account=3cDqWgoAAAAZXc8D3pDqwa77IryJ2nnY
NNTP-Posting-Host: 94.60.27.164
References: <DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com>
<sr3bi3$fu2$1@dont-email.me> <AOmdnX_3T5ObO0r8nZ2dnUU7-IHNnZ2d@earthlink.com>
<sr8emg$u51$1@franka.jacob-sparre.dk> <QsSdnadOQ8MVXUb8nZ2dnUU7-I3NnZ2d@earthlink.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9e90006a-59f4-40fb-8b0f-ef5f957d3d86n@googlegroups.com>
Subject: Re: Ok - WHAT are those "Maps.Identity" things ???
From: amado.al...@gmail.com (Marius Amado-Alves)
Injection-Date: Mon, 10 Jan 2022 10:19:07 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 7
 by: Marius Amado-Alves - Mon, 10 Jan 2022 10:19 UTC

> Hate typing long things ... made one-liners S2U() and
> U2S() if you can guess what those are :-)

This is totally line with the strict typing of Ada (no implicit conversion).
Most of us abbreviate even more as "+".

Sorry, but I fail to see any reason the standard Ada.Strings Index functions would not work for your usecases. If possible please provide a succint explanation.

Re: Ok - WHAT are those "Maps.Identity" things ???

<ly35lv8wd4.fsf@pushface.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6527&group=comp.lang.ada#6527

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!8nKyDL3nVTTIdBB8axZhRA.user.46.165.242.75.POSTED!not-for-mail
From: sim...@pushface.org (Simon Wright)
Newsgroups: comp.lang.ada
Subject: Re: Ok - WHAT are those "Maps.Identity" things ???
Date: Mon, 10 Jan 2022 15:05:11 +0000
Organization: Aioe.org NNTP Server
Message-ID: <ly35lv8wd4.fsf@pushface.org>
References: <DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com>
<sr44qc$i68$1@dont-email.me>
<WcidnROWEIzHNUr8nZ2dnUU7-b3NnZ2d@earthlink.com>
<sr92c3$ovp$1@dont-email.me>
<ULidnZpWIOC2J0b8nZ2dnUU7-Q_NnZ2d@earthlink.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: gioia.aioe.org; logging-data="18908"; posting-host="8nKyDL3nVTTIdBB8axZhRA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin)
X-Notice: Filtered by postfilter v. 0.9.2
Cancel-Lock: sha1:q1mf9KWYDCHzhRjcxTayIgD49WU=
 by: Simon Wright - Mon, 10 Jan 2022 15:05 UTC

"1.AAC0832" <z24ba7.net> writes:

> This group is so packed with spam that I wondered if anybody real
> still used it.

I was going to say "what?" but if I look via Google Groups I see what
you mean. Just had a merry few minutes marking posts as abuse.

Re: Ok - WHAT are those "Maps.Identity" things ???

<j4SdnSilx91oj0D8nZ2dnUU7-eWdnZ2d@earthlink.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6528&group=comp.lang.ada#6528

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 10 Jan 2022 23:17:41 -0600
Subject: Re: Ok - WHAT are those "Maps.Identity" things ???
Newsgroups: comp.lang.ada
References: <DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com>
<sr44qc$i68$1@dont-email.me> <WcidnROWEIzHNUr8nZ2dnUU7-b3NnZ2d@earthlink.com>
<sr92c3$ovp$1@dont-email.me> <ULidnZpWIOC2J0b8nZ2dnUU7-Q_NnZ2d@earthlink.com>
<ly35lv8wd4.fsf@pushface.org>
From: z24ba7....@nowhere (1.AAC0832)
Date: Tue, 11 Jan 2022 00:17:41 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
Thunderbird/68.12.0
MIME-Version: 1.0
In-Reply-To: <ly35lv8wd4.fsf@pushface.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Message-ID: <j4SdnSilx91oj0D8nZ2dnUU7-eWdnZ2d@earthlink.com>
Lines: 15
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 98.77.165.67
X-Trace: sv3-vJEE8jVnrfQs2y5hC8Wo5EbhALYKk4XgGXh6v7+pgAc2i1VGEhoum4cn9a4e4HboMVJDIQzIzE90Cls!ns6DG7jrwYyqO8IqDHNMNvFU57D2DlXyif18yLu2Enpq9/q38sAbTcyUTPHKhtD+ux7sgfrKgLdQ!YRv4kaeiVeq24MBTxSg=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 1868
 by: 1.AAC0832 - Tue, 11 Jan 2022 05:17 UTC

On 1/10/22 10:05 AM, Simon Wright wrote:
> "1.AAC0832" <z24ba7.net> writes:
>
>> This group is so packed with spam that I wondered if anybody real
>> still used it.
>
> I was going to say "what?" but if I look via Google Groups I see what
> you mean. Just had a merry few minutes marking posts as abuse.

Heh heh ... welcome to the underlying reality. Taking
the red pill has consequences :-)

For decades I never used kill lists - now there must
be a hundred items in there .........

Re: Ok - WHAT are those "Maps.Identity" things ???

<j4SdnSulx90CjkD8nZ2dnUU7-eUAAAAA@earthlink.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6529&group=comp.lang.ada#6529

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!buffer1.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 10 Jan 2022 23:20:31 -0600
Subject: Re: Ok - WHAT are those "Maps.Identity" things ???
Newsgroups: comp.lang.ada
References: <DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com>
<sr3bi3$fu2$1@dont-email.me> <AOmdnX_3T5ObO0r8nZ2dnUU7-IHNnZ2d@earthlink.com>
<sr8emg$u51$1@franka.jacob-sparre.dk>
<QsSdnadOQ8MVXUb8nZ2dnUU7-I3NnZ2d@earthlink.com>
<9e90006a-59f4-40fb-8b0f-ef5f957d3d86n@googlegroups.com>
From: z24ba7....@nowhere (1.AAC0832)
Date: Tue, 11 Jan 2022 00:20:31 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
Thunderbird/68.12.0
MIME-Version: 1.0
In-Reply-To: <9e90006a-59f4-40fb-8b0f-ef5f957d3d86n@googlegroups.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Message-ID: <j4SdnSulx90CjkD8nZ2dnUU7-eUAAAAA@earthlink.com>
Lines: 15
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 98.77.165.67
X-Trace: sv3-6nJRkLivVLvUvss6voD5Fm98S7D63jz83zEYIoqF9fx9qSqyCcTjyF0EZEnUj/D37iLMGmTIVBVSZAc!Drp4/NxUDHhJB84CIw5AbcwG/M2NJMm3/gVVdWtdM1scdCb1oJAGeGLiGbGb13NN75mssFMioyB6!BIYLOEfrQEq3z9Qbn9U=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 2097
 by: 1.AAC0832 - Tue, 11 Jan 2022 05:20 UTC

On 1/10/22 5:19 AM, Marius Amado-Alves wrote:
>> Hate typing long things ... made one-liners S2U() and
>> U2S() if you can guess what those are :-)
>
> This is totally line with the strict typing of Ada (no implicit conversion).
> Most of us abbreviate even more as "+".
>
> Sorry, but I fail to see any reason the standard Ada.Strings Index functions would not work for your usecases. If possible please provide a succint explanation.

It is suggested that the "needle" is a String string
instead of an unbounded. I'll check that out and report
once I finish my other project.

Oh well, meanwhile, I just wrote one that DOES work
with unboundeds.

Re: Ok - WHAT are those "Maps.Identity" things ???

<j4587tFa9phU1@mid.individual.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6530&group=comp.lang.ada#6530

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: niklas.h...@tidorum.invalid (Niklas Holsti)
Newsgroups: comp.lang.ada
Subject: Re: Ok - WHAT are those "Maps.Identity" things ???
Date: Tue, 11 Jan 2022 13:33:17 +0200
Organization: Tidorum Ltd
Lines: 18
Message-ID: <j4587tFa9phU1@mid.individual.net>
References: <DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com>
<sr44qc$i68$1@dont-email.me> <WcidnROWEIzHNUr8nZ2dnUU7-b3NnZ2d@earthlink.com>
<sr92c3$ovp$1@dont-email.me> <ULidnZpWIOC2J0b8nZ2dnUU7-Q_NnZ2d@earthlink.com>
<ly35lv8wd4.fsf@pushface.org>
<j4SdnSilx91oj0D8nZ2dnUU7-eWdnZ2d@earthlink.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net Wxwasefcs+U26vgyHAlKgAXXOtIMHZAt6gipMyPldegyzw9/bT
Cancel-Lock: sha1:Y9jo4OeRrfjyKlwqSnc9zrrbuYw=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0)
Gecko/20100101 Thunderbird/78.14.0
In-Reply-To: <j4SdnSilx91oj0D8nZ2dnUU7-eWdnZ2d@earthlink.com>
Content-Language: en-US
 by: Niklas Holsti - Tue, 11 Jan 2022 11:33 UTC

On 2022-01-11 7:17, 1.AAC0832 wrote:
> On 1/10/22 10:05 AM, Simon Wright wrote:
>> "1.AAC0832" <z24ba7.net> writes:
>>
>>> This group is so packed with spam that I wondered if anybody real
>>> still used it.
>>
>> I was going to say "what?" but if I look via Google Groups I see what
>> you mean. Just had a merry few minutes marking posts as abuse.
>
>   Heh heh ... welcome to the underlying reality. Taking
>   the red pill has consequences  :-)

So use comp.lang.ada through the Real(tm) USENET instead of Google Groups.

This group is not moderated, so there are occasional "meet the girls"
posts, but not enough to be troublesome.

Re: Ok - WHAT are those "Maps.Identity" things ???

<SY6dnd_had_2ykP8nZ2dnUU7-TvNnZ2d@earthlink.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=6531&group=comp.lang.ada#6531

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!buffer1.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Tue, 11 Jan 2022 22:22:03 -0600
Subject: Re: Ok - WHAT are those "Maps.Identity" things ???
Newsgroups: comp.lang.ada
References: <DpqdnRjI8_ercUn8nZ2dnUU7-UnNnZ2d@earthlink.com>
<sr44qc$i68$1@dont-email.me> <WcidnROWEIzHNUr8nZ2dnUU7-b3NnZ2d@earthlink.com>
<sr92c3$ovp$1@dont-email.me> <ULidnZpWIOC2J0b8nZ2dnUU7-Q_NnZ2d@earthlink.com>
<ly35lv8wd4.fsf@pushface.org>
<j4SdnSilx91oj0D8nZ2dnUU7-eWdnZ2d@earthlink.com>
<j4587tFa9phU1@mid.individual.net>
From: z24ba7....@nowhere (1.AAC0832)
Date: Tue, 11 Jan 2022 23:22:03 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
Thunderbird/68.12.0
MIME-Version: 1.0
In-Reply-To: <j4587tFa9phU1@mid.individual.net>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Message-ID: <SY6dnd_had_2ykP8nZ2dnUU7-TvNnZ2d@earthlink.com>
Lines: 33
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 98.77.165.67
X-Trace: sv3-lZ9ak5RUkeDjJMx7Zhtc3tWqmFR75/6otf9GFZOS0A2jTcXl6GBM7k46vt77WdpsxYGm9YVn1lXCY0i!T+yrP2LN2bvdFfKqcrIYrUZXzMuxvXgKGpjXZw6cqRQS32uILhzNsFtdtzQjVYXdB6w0ABt/fRKM!rrIYoexMdEIS/6hUhyQ=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 2633
 by: 1.AAC0832 - Wed, 12 Jan 2022 04:22 UTC

On 1/11/22 6:33 AM, Niklas Holsti wrote:
> On 2022-01-11 7:17, 1.AAC0832 wrote:
>> On 1/10/22 10:05 AM, Simon Wright wrote:
>>> "1.AAC0832" <z24ba7.net> writes:
>>>
>>>> This group is so packed with spam that I wondered if anybody real
>>>> still used it.
>>>
>>> I was going to say "what?" but if I look via Google Groups I see what
>>> you mean. Just had a merry few minutes marking posts as abuse.
>>
>>    Heh heh ... welcome to the underlying reality. Taking
>>    the red pill has consequences  :-)
>
>
> So use comp.lang.ada through the Real(tm) USENET instead of Google Groups.

I don't, and won't, use GG. Google shouldn't be allowed to
pretend it owns Usenet. It'll also spy on you and sell
your 'profile' to, well, anybody.

But you CAN get the unfiltered feed elsewhere. It's "truth",
even if ugly

> This group is not moderated, so there are occasional "meet the girls"
> posts, but not enough to be troublesome.

Um ... DO look at an unfiltered feed sometime. More
than "occasional" - like 20% of posts .....

Anyway, I'm halfway through my current obligatory project
and then I'll get back to more Ada.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor