From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=BAYES_05,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:a37:618e:: with SMTP id v136mr29613251qkb.151.1615901239489; Tue, 16 Mar 2021 06:27:19 -0700 (PDT) X-Received: by 2002:a25:2654:: with SMTP id m81mr6706448ybm.405.1615901239334; Tue, 16 Mar 2021 06:27:19 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 16 Mar 2021 06:27:19 -0700 (PDT) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=146.5.2.231; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 146.5.2.231 References: <89128f73-fcc5-4e57-8067-d09877ba0211n@googlegroups.com> <6ca041f3-2669-4497-9548-2f17666702a6n@googlegroups.com> <26c44e00-a899-455a-a929-1e23c7935fe3n@googlegroups.com> <9abb081d-a323-466d-9ae8-a2fc8fa24725n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: array from static predicate on enumerated type From: Shark8 Injection-Date: Tue, 16 Mar 2021 13:27:19 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:61563 List-Id: On Monday, March 15, 2021 at 2:25:11 PM UTC-6, Dmitry A. Kazakov wrote: > On 2021-03-15 18:48, Shark8 wrote: > > > So, in Ada, there's no good choice for how to actually DO an array with gaps in the index: > That applies to all containers. The problem is mapping the key to a > dense position when the key is not dense or might be unordered. > > There is no gaps in positions. > > But Array *isn't* a map, though often it is substituted as one. > Of course it is, per definition of mapping. f : key -> element. I think you misunderstand, I said it has further constraints. That definition of map doesn't care how the order of 'key' is, Ada's array does. That definition doesn't care if 'Key' is a discriminated-type, or constrained, or limited, Ada's array flat-out doesn't work without its 'key' (Index) being discrete, I don't know about limited as I haven't tried it. That definition doesn't care how the resultant 'element' is stored, Ada's array requires that they all be in contiguous memory. So, no, Array is not "a map" except when your problem space allows you to comply with [or ignore] all of those constraints and _then_ you may use it as one... which is exactly what I said above.