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=-2.9 required=3.0 tests=BAYES_00,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 22:46:34 -0600 Subject: Re: Ok - WHAT are those "Maps.Identity" things ??? Newsgroups: comp.lang.ada References: From: "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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Message-ID: 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 Xref: reader02.eternal-september.org comp.lang.ada:63362 List-Id: 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.