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=-0.9 required=3.0 tests=BAYES_00,XPRIO autolearn=no autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "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 Message-ID: References: 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 Xref: reader02.eternal-september.org comp.lang.ada:63352 List-Id: "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.