comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Can Ada iterate over Nd array?
Date: Thu, 26 Apr 2012 11:00:12 +0200
Date: 2012-04-26T11:00:12+02:00	[thread overview]
Message-ID: <4f990e9c$0$16280$9b4e6d93@newsspool1.arcor-online.net> (raw)
In-Reply-To: <slrnjphp76.i6m.oka.sux@localhost.localdomain>

On 26.04.12 08:02, Okasu wrote:
> On 2012-04-26, Jeffrey Carter<spam.jrcarter.not@spam.not.acm.org>  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.




  parent reply	other threads:[~2012-04-26  9:00 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-26  4:42 Can Ada iterate over Nd array? Okasu
2012-04-26  5:36 ` Jeffrey Carter
2012-04-26  6:02   ` Okasu
2012-04-26  6:05     ` Okasu
2012-04-26 10:57       ` ytomino
2012-04-26  8:01     ` Dmitry A. Kazakov
2012-04-27  0:36       ` Randy Brukardt
2012-04-27  1:58         ` Jerrid Kimball
2012-04-27  7:39           ` Martin
2012-04-27 18:08             ` Jeffrey Carter
2012-04-30  7:20               ` Martin
2012-04-30 13:21                 ` Robert A Duff
2012-04-30 15:42                   ` Martin
2012-04-27 16:06         ` Shark8
2012-04-26  9:00     ` Georg Bauhaus [this message]
2012-04-26 15:48     ` Adam Beneschan
2012-04-26 20:54       ` Okasu
2012-04-27  0:39       ` Randy Brukardt
2012-04-27 13:30         ` Robert A Duff
2012-04-28  8:24           ` Georg Bauhaus
2012-04-28  9:35             ` björn lundin
     [not found]               ` <raadncdcv9V-hgHSnZ2dnUVZ_v2dnZ2d@earthlink.com>
2012-04-28 23:19                 ` björn lundin
2012-04-30 14:48               ` gautier_niouzes
2012-05-01  2:02           ` Randy Brukardt
2012-04-27  4:19       ` Nasser M. Abbasi
2012-04-27 16:23       ` Bill Findlay
2012-04-26  9:40 ` gautier_niouzes
     [not found] ` <26754113.2767.1335431755764.JavaMail.geo-discussion-forums@vbki8>
2012-04-26 18:09   ` Jeffrey Carter
2012-04-27  0:28     ` BrianG
2012-04-27 13:46       ` Robert A Duff
2012-04-27 11:09 ` Stephen Leake
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox