comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Ceate a set (type?) of list of integers that varies at run time
Date: Sat, 27 Jan 2018 19:56:16 +0100
Date: 2018-01-27T19:56:16+01:00	[thread overview]
Message-ID: <p4ii0h$6j4$1@dont-email.me> (raw)
In-Reply-To: <d49808d6-8717-4a3e-ae09-c4b12eb787a5@googlegroups.com>

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


      parent reply	other threads:[~2018-01-27 18:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-26 23:58 Ceate a set (type?) of list of integers that varies at run time Mace Ayres
2018-01-27  7:20 ` Randy Brukardt
2018-01-27 18:56 ` Jeffrey R. Carter [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox