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=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,35edde140291c79e X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.232.42 with SMTP id tl10mr7633227pbc.7.1335491932808; Thu, 26 Apr 2012 18:58:52 -0700 (PDT) Path: r9ni102703pbh.0!nntp.google.com!news2.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!news.ecp.fr!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: Jerrid Kimball Newsgroups: comp.lang.ada Subject: Re: Can Ada iterate over Nd array? Date: Thu, 26 Apr 2012 20:58:49 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <18y0zty0yw1m3.1dkfnp5etqdk0$.dlg@40tude.net> NNTP-Posting-Host: wsip-72-215-219-68.om.om.cox.net Mime-Version: 1.0 X-Trace: munin.nbi.dk 1335491931 10113 72.215.219.68 (27 Apr 2012 01:58:51 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 27 Apr 2012 01:58:51 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120418 Thunderbird/12.0 In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-04-26T20:58:49-05:00 List-Id: bOn 04/26/2012 07:36 PM, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:18y0zty0yw1m3.1dkfnp5etqdk0$.dlg@40tude.net... >> On Thu, 26 Apr 2012 06:02:13 +0000 (UTC), Okasu wrote: >> >>> So you trying to say that i have to write loops for 10/100/1000d arrays >>> by hand? >> >> You should introduce an index type of your own (a Nth tuple) and use a >> flat >> container, e.g. a map over that index. >> >> Unfortunately Ada does not have 1st class indices, which was #10 in my >> wish >> list for Ada 202X. > > It does, however, have 2nd class indices (see 4.1.6), which work better than > first class indicies most of the time. > > Also, you can iterate over the entire array without using any indicies in > Ada 2012: > > for E of A loop > null; > end loop; > > This also works for containers. > > But this doesn't work in earlier versions of Ada. > > Randy. > > And in a recent GNAT wavefront, it seems to only work for one-dimensional arrays. Otherwise, you get an error "too few subscripts in array reference" which doesn't make a lot of sense. This is 7.1w from January, but supposedly 7.0 has full 2012 support. I've noticed a lot of problems in this wavefront regarding 2012 support so hopefully they're not issues in 7.0 stable.