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: a07f3367d7,d00514eb0749375b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder.news-service.com!feeder.erje.net!news2.arglkargh.de!news.tornevall.net!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: initialize an array (1-D) at elaboration using an expression based on the index? Date: Fri, 15 Oct 2010 17:52:14 -0700 Organization: TornevallNET - http://news.tornevall.net Message-ID: References: NNTP-Posting-Host: 254a431b4c3d17e35fc472e70aabbc95 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: 305cb78c7884879e71aa4e29400effd8 X-Complaints-To: abuse@tornevall.net User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 X-Complaints-Language: Spoken language is english or swedish - NOT ITALIAN, FRENCH, GERMAN OR ANY OTHER LANGUAGE! In-Reply-To: X-UserIDNumber: 1738 X-Validate-Post: http://news.tornevall.net/validate.php?trace=305cb78c7884879e71aa4e29400effd8 X-Complaints-Italiano: Non abbiamo padronanza della lingua italiana - se mandate una email scrivete solo in Inglese, grazie X-Posting-User: 0243687135df8c4b260dd4a9a93c79bd Xref: g2news2.google.com comp.lang.ada:15530 Date: 2010-10-15T17:52:14-07:00 List-Id: On 10/15/2010 04:03 PM, Nasser M. Abbasi wrote: > > I was wondering if in Ada I can initialize some array, where I can fill > the content of each entry in the array based on some function of the index? > > > In Ada, what would I need to do in the initialization below? > --------------------------- > a: array(1..N) of float := (others=>0.0); --?? Of course, if you're willing to avoid the evil that is anonymous types and write a function: type Meaningful_Type_Name is array (1 .. N) of Float; function Meaningful_Function_Name return Meaningful_Type_Name is ... Meaningful_Object_Name : Meaningful_Type_Name := Meaningful_Function_Name; -- Jeff Carter "Strange women lying in ponds distributing swords is no basis for a system of government." Monty Python & the Holy Grail 66