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,9c8d43df5d883263,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-15 04:30:13 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!dispose.news.demon.net!news.demon.co.uk!demon!billybob.demon.co.uk!not-for-mail From: brianc@billybob.demon.co.uk (Brian A Crawford) Newsgroups: comp.lang.ada Subject: Two Dimensional Array Date: Fri, 15 Feb 2002 12:30:42 GMT Message-ID: <3c6cf3db.11214605@news.demon.co.uk> NNTP-Posting-Host: billybob.demon.co.uk X-NNTP-Posting-Host: billybob.demon.co.uk:194.222.76.2 X-Trace: news.demon.co.uk 1013776195 nnrp-13:11192 NO-IDENT billybob.demon.co.uk:194.222.76.2 X-Complaints-To: abuse@demon.net X-Newsreader: Forte Free Agent 1.11/32.235 Xref: archiver1.google.com comp.lang.ada:20040 Date: 2002-02-15T12:30:42+00:00 List-Id: I have a program to read two numbers at a time from a file and then use a two dimensional array to look at that reference to see if a number 1 or 0 in assigned to the cell referenced. For example if the numbers are 14,20 it would look up this in the array and return a 1 say. I have already got it to work (see fragment below) however the real world problem is that the numbers 1 to 50 are not actually in numerical order but jumbled up in a different sequence. The code fragment shows the end result of my efforts so far. My problem is associating the values 1 or 0 to each cell of the array. By having the numbers 1 to 50 in numerical order the numbers 1 and 0 are very haphazard placed and are difficult to define and update. If the array was firstly defined as say 1,21,34,50,17,4, etc, 48,16 then the 1 and 0 are placed together in the array and are very easy to associate quickly in groups of 5. Example Event := (1 => (1,1,1,1,1,0,0,0,0,0,1,1,1,1,1 etc 21 => (0,0,0,0,0,1,1,1,1,1,0,0,0,0,0, etc 34 => (0,0,0,0,0,0,0,0,0,0,1,1,1,1,1, etc and so on. This is a code fragment. Number1 : Integer; Number2 : Integer; subtype Firstevent is Integer range 1..50; subtype Secondevent is Integer range 1..50; type Two_Events_Type is array (Firstevent, Secondevent) of Integer; Event : Two_Events_Type; begin --get input data Event := (0 => (1,0,0,1,0,1,1,0,0,0,0,1,1,0,1,1,1,0,1,etc,0,1,0,1,1,1,0,0,1,1), 1=>(1,1,0,1,0,0,1,0,0,1,1,1,etc 2=> and so forth as you can see the 1's and 0's are all over the place. How can I define subtypes FirstEvent and SecondEvent out of sequence? Secondly then can I make an abbreviation to the array referencing eg if AN is the sequence of 5 x 1's at {3,4,5,6,7} and BN is is the sequence of 5 x 1's at {17,18,19,20,21} position and similar for CN DN EN etc how may I use that abbreviation in some way like this? Event := (0 => (AN, BN, others => 0), 21 => (CN, others =>0), 34 => (DN, AN, CN, others 0)) etc Thank you for any pointers. Regards Brian