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 autolearn=ham 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.204.143.143 with SMTP id v15mr857795bku.8.1335455291114; Thu, 26 Apr 2012 08:48:11 -0700 (PDT) Path: h15ni168250bkw.0!nntp.google.com!news1.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Can Ada iterate over Nd array? Date: Thu, 26 Apr 2012 08:48:10 -0700 (PDT) Organization: http://groups.google.com Message-ID: <393172.2032.1335455290715.JavaMail.geo-discussion-forums@yntt13> References: NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 X-Trace: posting.google.com 1335455290 3013 127.0.0.1 (26 Apr 2012 15:48:10 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 26 Apr 2012 15:48:10 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-04-26T08:48:10-07:00 List-Id: On Wednesday, April 25, 2012 11:02:13 PM UTC-7, Okasu wrote: > On 2012-04-26, Jeffrey Carter wrote: > > > > type Three_D is array (1 .. 3, 7 .. 300, 'A' .. 'Z') of Integer; > > > > A : Three_D; > > > > for I in A'range (1) loop > > for J in A'range (2) loop > > for K in A'range (3) loop > > -- Do something with A (I, J, K) > > end loop; > > end loop; > > end loop; > > >=20 > It's a brain dead code. > So you trying to say that i have to write loops for 10/100/1000d arrays > by hand? I don't think I've *ever* seen an array with more than three dimensions eve= r used, in 35 years of programming. (Exception: I think I once created a 4= -dimensional array in APL in an attempt to write a one-line function to do = something complicated. But that's more of a game, not really programming.)= If you really need a way to associate arbitrarily long tuples with elemen= ts, you probably should be using some other kind of structure than an array= . But I think Ada 2012 does support what you're looking for; see the example = at the bottom of 5.5.2 (http://www.ada-auth.org/standards/12rm/html/RM-5-5-= 2.html). -- Adam