title: array type variable name created programmatically?
body: <p>In Ada, I wish to create 10 two dimensional arrays of type array (0..9) Integer, creating 10 x 10 arrays of cells, which I will manipulate by indices. I want to be able to address each of the 10 layers separately, ideally by hybrid variable name like “layer_(i)” (row, col) := xxx, rather than having to access each layer_x by its static name like “layer_1” or “layer_2”, so I could run the same procedure algorithm against each layer and just vary my indices to suit each layer.</p>
  
  <p>I have: </p>
  
  <pre><code>type grid is array (0..9) of Integer, (0..9) of integer;
  layer_1, layer_2, layer_3, layer_4, layer_5,
    layer_6, layer_7, layer_8, layer_9, layer_0: grid;
  </code></pre>
  
  <p>Is there anyway I can create a variable of type grid, dynamically so that i can address it by “layer_”(x) rather than the full static name “layer_1” ?</p>
  
  <p>======
  After posting this, I realized one possible solution, though it does not directly address the specifics in the question, but an alternative solution.</p>
  
  <p>I could create a three dimensional array, or an array of the two dimensional arrays, I could address as block(l,r,c) l for layer, r for row, and c for column, and not have full variable names like Layer_1, layer_2, etc.In either case, I will have 1,000 cells. Maybe there is no way around this, when thinking of the structure in arrays, though arrays seems the first test choice rather than a list of cells, which would involve some referenceing of prior and following cells that would be hard for human conceptualization, but fine for the machine.</p>
  
  <p>=====
  And, thinking further I see I don’t want a three dimensional array, but a single 1 dimensional array of 10 instances of the two dimension 10 x 10 arrays will work. I can address with 3 nested loops and use the same code pretty much when manipulating the 100 cells in each 10 by 10 array, depending on the primary array of 10x10 arrays and have immediate access to every cell in every 10 by 10 grid with loop varibles l,r,c.</p>