From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.5 required=3.0 tests=BAYES_05,NICE_REPLY_A autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!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: From: "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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Message-ID: 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 Xref: reader02.eternal-september.org comp.lang.ada:63364 List-Id: On 1/6/22 11:14 PM, Randy Brukardt wrote: > "1.AAC0832" 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 ....