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.230.98 with SMTP id sx2mr1076261pbc.1.1335430813659; Thu, 26 Apr 2012 02:00:13 -0700 (PDT) Path: r9ni100053pbh.0!nntp.google.com!news2.google.com!goblin2!goblin1!goblin.stu.neva.ru!news.musoftware.de!wum.musoftware.de!weretis.net!feeder4.news.weretis.net!news.teledata-fn.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Thu, 26 Apr 2012 11:00:12 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Can Ada iterate over Nd array? References: In-Reply-To: Message-ID: <4f990e9c$0$16280$9b4e6d93@newsspool1.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 26 Apr 2012 11:00:12 CEST NNTP-Posting-Host: 0e023849.newsspool1.arcor-online.net X-Trace: DXC=485LS1TML>9RLigj];iP=8ic==]BZ:af>4Fo<]lROoR14nDHegD_]R5ldd4>I`_iQ0A:ho7QcPOV3i\HQGK[Rfk5Zi@0Q05?6d7 X-Complaints-To: usenet-abuse@arcor.de Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-04-26T11:00:12+02:00 List-Id: On 26.04.12 08:02, 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; >> > > It's a brain dead code. > So you trying to say that i have to write loops for 10/100/1000d arrays > by hand? This will depend on your arrays. With typical languages, typically, yes. Like in C, C++, Fortran, Pascal, Lisp, ML, OCaml, Java, etc etc, arrays in Ada are basic. Array indexing uses the same scheme as everyone else, except that Ada lets you specify 'Range, 'First, and so on, no mishaps there. Even for an array of dimension 1000, the scheme does not change in any of these languages. (I will be very interested in seeing an array of dimension 1000 that isn't sparse.) APL, SETL, R, and other languages are different. When there is some library made for arrays, it can allow notions such as "apply a subprogram Proc (First, Last: Vector) to the block of dimension N between First and Last" where N = Length(First) = Length(Last). There are some such libraries for Ada, even in its standard library.