From: "Nasser M. Abbasi" <nma@12000.org>
Subject: Re: How to initialize a matrix of one column only?
Date: Sat, 07 Jul 2012 21:09:56 -0500
Date: 2012-07-07T21:09:56-05:00 [thread overview]
Message-ID: <jtaq5o$fcr$1@speranza.aioe.org> (raw)
In-Reply-To: nospam-E0F1CA.21470907072012@news.aioe.org
On 7/7/2012 8:47 PM, John B. Matthews wrote:
....
>> I tried B:=(1=>9.0,2=>2.03=>-2.0);
...
>>
>> What is the correct syntax to use?
>
> According to 4.3.3 Array Aggregates, you need to use named notation for
> a single component, otherwise "a single expression in parentheses is
> interpreted as a parenthesized expression."
>
> B := ((1 => 9.0),
> (1 => 2.0),
> (1 => -2.0));
>
> <http://www.ada-auth.org/standards/12rm/html/RM-4-3-3.html>
>
Thanks John. I think I did browse some of these RM notes, but
I either missed it or did not understand it (sometimes
the RM writing is hard to understand for me).
But the above is a good example of why Ada has the
reputation of being too verbose.
Compare the above to Matlab for example to make
a matrix of one column
B=[9 2 -2]'
or Mathematica
B={{9},{2},{-2}}
But I guess on the other hand, one gets the strong typing
as a payback for all this extra typing. So may be one can't
complain too much.
regards,
--Nasser
next prev parent reply other threads:[~2012-07-08 2:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-08 0:08 How to initialize a matrix of one column only? Nasser M. Abbasi
2012-07-08 0:20 ` Nasser M. Abbasi
2012-07-08 1:47 ` John B. Matthews
2012-07-08 2:09 ` Nasser M. Abbasi [this message]
2012-07-08 17:05 ` Brian Drummond
2012-07-13 15:19 ` Robert A Duff
2012-07-13 16:11 ` gautier_niouzes
2012-07-08 7:27 ` Simon Wright
2012-07-08 7:43 ` Stephen Leake
2012-07-08 22:56 ` Jerry
2012-07-09 9:35 ` Simon Wright
2012-07-12 4:13 ` Jerry
2012-07-12 8:50 ` Simon Wright
2012-07-13 23:15 ` Jerry
2012-07-14 9:46 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox