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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1f8b4cce7e72b123 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-25 23:44:55 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.onemain.com!feed1.onemain.com!nntp2.onemain.com.POSTED!not-for-mail From: Eric G. Miller Newsgroups: comp.lang.ada Subject: Re: Arrays and Access types... Message-ID: <20011025234515.5dfa2af1.egm2@jps.net> References: <20011025214647.2788a60b.egm2@jps.net> <3BD8F70E.3667B286@worldnet.att.net> X-Newsreader: Sylpheed version 0.6.3 (GTK+ 1.2.10; i386-debian-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Date: Thu, 25 Oct 2001 23:45:15 -0700 NNTP-Posting-Host: 216.119.36.160 X-Complaints-To: abuse@onemain.com X-Trace: nntp2.onemain.com 1004078410 216.119.36.160 (Fri, 26 Oct 2001 02:40:10 EDT) NNTP-Posting-Date: Fri, 26 Oct 2001 02:40:10 EDT Xref: archiver1.google.com comp.lang.ada:15217 Date: 2001-10-25T23:45:15-07:00 List-Id: On Fri, 26 Oct 2001 05:39:09 GMT, James Rogers wrote: > Unlike C, Ada arrays are not directly related to access types or > pointers. So, I am learning... > There are several ways to solve your problem. My personal approach > would be to create a record structure to keep track of your slicing > on a single array element. One such data structure follows: I think this type of approach would work, and would avoid multiple "new" calls. For the particular problem I'm looking at, I will have three subsets for each iteration. I think the other posters suggestion to use a recursive function would work well since the initial data size is fairly small and the algorithm will find the answer in 5 calls or less. I'm a little confused about the use of generics and what it is providing here... Is it for the "Element" type, so's the package doesn't have to care what type of thing it is? If that's the case, does the "outside world" have to declare a subtype of Element to use this generic? or will any type do? I haven't really gotten to generics yet (just working on the basics at the moment). > --- Slicable array package > generic > Max_Size : Positive; > type Element is private; > package Slicing_Array is > > subtype Array_Index is Positive range 1..Max_Size; > type Element_Array is array(Array_Index range <>) of Element; > type Slicable_Array is private; -- Eric G. Miller