* Ceate a set (type?) of list of integers that varies at run time
@ 2018-01-26 23:58 Mace Ayres
2018-01-27 7:20 ` Randy Brukardt
2018-01-27 18:56 ` Jeffrey R. Carter
0 siblings, 2 replies; 3+ messages in thread
From: Mace Ayres @ 2018-01-26 23:58 UTC (permalink / raw)
* 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?
...
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Ceate a set (type?) of list of integers that varies at run time
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
1 sibling, 0 replies; 3+ messages in thread
From: Randy Brukardt @ 2018-01-27 7:20 UTC (permalink / raw)
"Mace Ayres" <mace.ayres@gmail.com> wrote in message
news:d49808d6-8717-4a3e-ae09-c4b12eb787a5@googlegroups.com...
...
>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?
You can use a static predicate to define a subtype with such a set, and then
iterate over it.
However, as the name implies, you can't define such a set at runtime; you
have to do that with conditionals.
Randy.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Ceate a set (type?) of list of integers that varies at run time
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
1 sibling, 0 replies; 3+ messages in thread
From: Jeffrey R. Carter @ 2018-01-27 18:56 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-27 18:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox