comp.lang.ada
 help / color / mirror / Atom feed
From: "John B. Matthews" <nospam@nospam.invalid>
Subject: Re: how to print an array range?
Date: Tue, 26 Jun 2012 13:05:06 -0400
Date: 2012-06-26T13:05:06-04:00	[thread overview]
Message-ID: <nospam-DACCD7.13050626062012@news.aioe.org> (raw)
In-Reply-To: jscnv3$9kt$1@speranza.aioe.org

In article <jscnv3$9kt$1@speranza.aioe.org>,
 "Nasser M. Abbasi" <nma@12000.org> wrote:

> On 6/26/2012 10:53 AM, Georg Bauhaus wrote:
> > On 26.06.12 16:24, Nasser M. Abbasi wrote:
> >> But I wanted to see the range of
> >> the first dimension of the Matrix A below. (1..3, 1..3)
> >
> > Specify the ranges you want, for example,
> >
> > A : constant Real_Matrix (1 .. 3, 1 .. 3) :=
> >       (( 1.0,  2.0,  3.0),
> >        ( 4.0,  5.0,  6.0),
> >        ( 7.0,  8.0,  9.0));
> >
> 
> I think I am not explaining myself well.
> 
> I simply wanted to print the range itself, after
> I define a variable. using PUT().
> 
> i.e. in the above, what would one write to
> print  "1..3" for A'range(1) and "1..3" for A'range(2)?
> 
> I am not asking how to specify the range, I know that.
> but to print it, for debugging purposes.
> 
> I can't just type write put(A'range(1)). And when I write
> put(A'first(1)) it prints -2147483648.
> 
> Any way, no big deal, will figure it out.

For debugging:

Ada.Text_IO.Put_Line(A'First'Img & " " & A'Last'Img);

Which also sheds light on your previous finding:

B : Real_Matrix(A'Range(1), A'Range(2)); -- correct
B : Real_Matrix(A'Range(1), Integer'First .. Integer'First + 2);

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>



  parent reply	other threads:[~2012-06-26 17:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-26 13:47 how to print an array range? Nasser M. Abbasi
2012-06-26 13:54 ` Georg Bauhaus
2012-06-26 14:08   ` Nasser M. Abbasi
2012-06-26 14:24     ` Nasser M. Abbasi
2012-06-26 15:07       ` AdaMagica
2012-06-26 15:53       ` Georg Bauhaus
2012-06-26 16:28         ` Nasser M. Abbasi
2012-06-26 16:58           ` Georg Bauhaus
2012-06-26 17:05           ` John B. Matthews [this message]
2012-06-26 17:13             ` Georg Bauhaus
2012-06-26 19:28               ` John B. Matthews
2012-06-26 17:15           ` Adam Beneschan
2012-06-26 21:31     ` Robert A Duff
2012-06-26 22:17       ` Dmitry A. Kazakov
2012-06-26 22:39       ` Randy Brukardt
     [not found]       ` <33dku79r14uuvmlgpodg9ri7prnq9v5f94@invalid.netcom.com>
2012-06-26 23:13         ` Jeffrey Carter
2012-06-27  6:58           ` Jacob Sparre Andersen
2012-06-26 14:07 ` Dmitry A. Kazakov
2012-06-28  6:59 ` Shark8
replies disabled

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