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-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-3.2 required=3.0 tests=BAYES_00,NICE_REPLY_A, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R.Carter" Newsgroups: comp.lang.ada Subject: Re: New aggregates with Ada 2022. Date: Wed, 29 Jun 2022 14:53:33 +0200 Organization: A noiseless patient Spider Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 29 Jun 2022 12:53:33 -0000 (UTC) Injection-Info: reader01.eternal-september.org; posting-host="85e83e0c9dc48db23f43f5acbe7e9d59"; logging-data="1519332"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19IbL52QobCc7oEM2i1np9FhedK2IWQiuA=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Cancel-Lock: sha1:tX1pBuDmak7dRi2EhoHHDknLfzk= Content-Language: en-US In-Reply-To: Xref: reader01.eternal-september.org comp.lang.ada:64052 List-Id: On 2022-06-29 13:06, Niklas Holsti wrote: > On 2022-06-29 11:30, Jeffrey R.Carter wrote: >> >> * Maps are usually constrained. It does not make sense to concatenate, sort, >> slice, or slide a map. > > In mathematics, maps (functions) are often sliced, in other words restricted to > a subset of their full domain. They are also often concatenated, in the sense of > combining functions defined on separate domain sets into a combined function > defined on the union of those separate domain sets. Those operations would be > useful in programs too. > > The essential aspect of maps and map operations is that there is no "sliding" > that changes the relationship of domain values (keys) with range values. > > That said, it very often makes sense to provide sorted access to the elements of > a map, sorted by some criterion, while maintaining the relationship of keys and > their mapped values. That might be seen as sorting the map into a sequence (as > described below). Perhaps I could have been clearer. I mean that it doesn't make sense to concatenate, sort, slice, or slide an array used as a map. For example, if we represent a map Character => Natural as type Char_Count_Map is array (Character) of Natural; Map : Char_Count_Map; and want a map with the domain restricted to the ASCII letters, both capital and small, Map ('A' .. 'Z') & Map ('a' ..'z') doesn't do what we want. You are talking about the abstraction of a map in general, and the operations you describe are different from the array operations I was talking about. -- Jeff Carter "[T]he language [Ada] incorporates many excellent structural features which have proved their value in many precursor languages ..." C. A. R. Hoare 180