-- Collection of code snippets by Arne Vajhøj 
-- (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
with Ada.Text_IO,Ada.Integer_Text_IO;

use Ada.Text_IO,Ada.Integer_Text_IO;

procedure IndexFun is

type ix1vals is (a, b, c);
type ix2vals is (x, y);
type intmatrix is array(ix1vals, ix2vals) of Integer;

ia : intmatrix;

begin
    for ix1 in ix1vals loop
        for ix2 in ix2vals loop
            ia(ix1, ix2) := 10 * ix1vals'Pos(ix1) + ix2vals'Pos(ix2);
        end loop;
    end loop;
    -- should have been ia(c, y)
    ia(y, c) := 77;
    for ix1 in ix1vals loop
        for ix2 in ix2vals loop
            Put(ia(ix1, ix2));
        end loop;
        New_Line;
    end loop;
end IndexFun;
