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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Ceate a set (type?) of list of integers that varies at run time Date: Sat, 27 Jan 2018 19:56:16 +0100 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sat, 27 Jan 2018 18:56:17 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="2e25fd79c2a1a9f582db6c9d97178a12"; logging-data="6756"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+6I4mZjRaf2UNskUtzwEnEXg/L6ll00Qc=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 In-Reply-To: Content-Language: en-US Cancel-Lock: sha1:HaQ6U8/KmYs42T1X4PFeVZVmGuY= Xref: reader02.eternal-september.org comp.lang.ada:50187 Date: 2018-01-27T19:56:16+01:00 List-Id: On 01/27/2018 12:58 AM, Mace Ayres wrote: > * Using the word set in mathetical sense. > I have an array 2D_array is Integer 1..9, 1..9 of my_record. — my_record has a boolean field locked. > Before looping/iteration across 2D_array (r,c), I want to restrict the columns (c) that I process, to bet something like > for r in 1..9 loop > for c (column) in (columns_to_check) > > I have to create the enumeration type? list of columns to check and put in my columns_to_check container > and then only iterate these, maybe 1,2,3,7,8,9 — do not check 4,5 or 6 > > Need a function like get_columns_to_check > that iterates all 1..9 columns > if (r,c).locked is true > then do not have in final columns_to_check something (range, or enumeration type) > either add to empty columns_to_check or delete from default columns_to_check that has 1..9; > > what kind, type of an object can I use to hold the valid columns to check thing-e columns_to_check > and that I can also iterate across. > > Can I have a range that is not a continuous series of integers, NOT 1..9 but 1,2,5,6,7,9 > and then some different subset of 1..9 the next time. Recalculating a new set Columns_to_check for each outer loop of rows? Is there some reason you can't do something like type Column_Set is array (Column_Number) of Boolean; Checkable : Column_Set; for C in Checkable'range loop -- set Checkable (C) end loop; for R in A'range (1) loop for C in A'range (2) loop if Checkable (C) then -- do something with A (R, C) end if; end loop; end loop; -- Jeff Carter "Mr. President, we must not allow a mine-shaft gap!" Dr. Strangelove 33