From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.31.115.14 with SMTP id o14mr1700854vkc.36.1485525892078; Fri, 27 Jan 2017 06:04:52 -0800 (PST) X-Received: by 10.157.52.34 with SMTP id v31mr580752otb.9.1485525892030; Fri, 27 Jan 2017 06:04:52 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!feeder3.usenet.farm!2.eu.feeder.erje.net!feeder.erje.net!2.us.feeder.erje.net!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder1.iad1.usenetexpress.com!216.166.98.84.MISMATCH!border1.nntp.dca1.giganews.com!nntp.giganews.com!q58no441610qte.0!news-out.google.com!15ni13849itm.0!nntp.google.com!r185no646627ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 27 Jan 2017 06:04:51 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2a02:c7d:3cda:7600:932b:b705:6315:5a80; posting-account=L2-UcQkAAAAfd_BqbeNHs3XeM0jTXloS NNTP-Posting-Host: 2a02:c7d:3cda:7600:932b:b705:6315:5a80 References: <0fbd77dd-bcc2-462c-9ca3-be1ffb51e0c6@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: REQ: Extend slices for n dimensional arrays for Ada 202X From: Lucretia Injection-Date: Fri, 27 Jan 2017 14:04:52 +0000 Content-Type: text/plain; charset=UTF-8 Xref: news.eternal-september.org comp.lang.ada:33197 Date: 2017-01-27T06:04:51-08:00 List-Id: On Thursday, 26 January 2017 14:52:04 UTC, Dmitry A. Kazakov wrote: > On 26/01/2017 15:01, Lucretia wrote: > > On Thursday, 26 January 2017 13:29:47 UTC, Lucretia wrote: > > > >> > >> Texture (x1 .. x2, y1 .. y2) := Buffer; -- Buffer is the correct size. > > > > I forgot to mention something else. I put the above notation down as > > someone in #Ada liked tha, but I would prefer the following: > > > > Texture (x1, y1 .. x2, y2) := Buffer; -- Buffer is the correct size. > > I don't understand the latter. (X1, Y1) .. (X2, Y2) is not a submatrix > it is a linear slice: You're being deliberately obtuse. I even spelt out the semantics above. The language designers spell out the semantics of the language constructs as I did. For the 1D case, we define an array as: type Some_Array is array (Positive range 1 .. 5) of Integer; Access an element with: T : Some_Array; T (4) := 3; Slice with: S : Some_Array := T (2 .. 4); For the 2D and above case, we define an array as: type Some_Array is array (Positive range 1 .. 5, Positive range 1 .. 10) of Integer; Access an element with: T : Some_Array; T (1, 1) := 3; So we could slice with: S : Some_Array := T (2, 2 .. 4, 6); -- Square slice! So in the following case (row-major order): | 1 2 3 4 ----------- 1 | a e i m 2 | b f j n 3 | c g k o 4 | d h l p A slice of (2,2 .. 3,4) would give: | 1 2 ------- 1 | f j 2 | g k 3 | h l Not a linear vector, because that's not the semantics I'm looking for, is it? > > You forgot notation for whole index range: > > I (<>, 1) -- column 1. This is irrelevant as you cannot assign I (<>) in the 1D case anyway. Luke.