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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,26e047a7a0709881 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.223.40 with SMTP id qr8mr18929908pbc.0.1341767121918; Sun, 08 Jul 2012 10:05:21 -0700 (PDT) Path: l9ni11132pbj.0!nntp.google.com!news1.google.com!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: How to initialize a matrix of one column only? Date: Sun, 8 Jul 2012 17:05:21 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Injection-Date: Sun, 8 Jul 2012 17:05:21 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="DkTdSjxOCm6DqG+Uf7eArg"; logging-data="5429"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/CsYNFMnhMF3V0nqQQEYim/r+uKFPqy14=" User-Agent: Pan/0.135 (Tomorrow I'll Wake Up and Scald Myself with Tea; GIT 30dc37b master) Cancel-Lock: sha1:7bQDLKCXLvwnHpoIGA9GGks4b04= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Date: 2012-07-08T17:05:21+00:00 List-Id: On Sat, 07 Jul 2012 21:09:56 -0500, Nasser M. Abbasi wrote: > 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)); > But the above is a good example of why Ada has the reputation of being > too verbose. To be fair, Ada is not always so verbose; a 1-column array is an unusual case. If you need to write this more than once, I would try to abstract out the ugliness with a function taking a vector and returning the 1-column equivalent. For an initialisation, I would be surprised if there was any overhead at all... - Brian