comp.lang.ada
 help / color / mirror / Atom feed
From: Peter Hermann <ica2ph@iris16.csv.ica.uni-stuttgart.de>
Subject: Re: Slices of 2d arrays?
Date: Wed, 24 Jul 2002 13:47:51 +0000 (UTC)
Date: 2002-07-24T13:47:51+00:00	[thread overview]
Message-ID: <ahmb67$jjb$1@news.uni-stuttgart.de> (raw)
In-Reply-To: dstanbro-119EAB.19285524072002@mec2.bigpond.net.au

Dale Stanbrough <dstanbro@bigpond.net.au> wrote:
> I've always been under the impression that you could take a 
> horizontal slice of a 2d array, but for the life of me I can't
> find it in the LRM, or get it to work. Does anyone know
> whether this exists, or is it just a figment of my overworked 
> imagination?

imagination is always a fine thing

> I would like to be able to do...
>    type grid is array (1..10, 1..10) of character;
>    g : grid;
>    ...
>    put (g (1, 4..5));

Apart from the pragmatic solution (as Pascal Obry already proposed)
for your special case:
    subtype s10 is string(1..10);
    type grid is array(1..10) of s10;
    begin
    g(1)(1) := 'x';

there may be an incentive for Ada2005 thoughts on index ranges
in place of index position. I can not oversee all the implications
which a language lawyer may see.  Important may be the aspect:
   g(1   ,4   ) is of type character
   g(1..1,4..5) is of type grid
   g(1   ,4..5) is of type grid slice?
   g(1..1,4   ) is of type grid slice?
   and the n-dimensional arrays?

No.   Language designers will certainly refusei, IMHO.

-- 
--Peter Hermann(49)0711-685-3611 fax3758 ica2ph@csv.ica.uni-stuttgart.de
--Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
--http://www.csv.ica.uni-stuttgart.de/homes/ph/
--Team Ada: "C'mon people let the world begin" (Paul McCartney)



  parent reply	other threads:[~2002-07-24 13:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-24  9:29 Slices of 2d arrays? Dale Stanbrough
2002-07-24  9:39 ` Lutz Donnerhacke
2002-07-24 12:41   ` Pascal Obry
2002-07-25  0:38   ` Robert Dewar
2002-07-24 13:47 ` Peter Hermann [this message]
2002-07-25  0:33   ` Robert Dewar
2002-07-25 11:26     ` Slices of 2d arrays? +HPF Peter Hermann
2002-07-25 13:04       ` Jacob Sparre Andersen
2002-07-25 15:58         ` Darren New
2002-07-28 23:54           ` Robert Dewar
2002-07-25 20:31     ` Slices of 2d arrays? Robert A Duff
2002-07-25 21:09       ` Chad R. Meiners
2002-07-29 13:37         ` Robert Dewar
2002-07-29 14:08           ` Steffen Huber
replies disabled

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