--  filters and reverse over a matrix (T32a)
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
   subtype Small is Integer range -100 .. 100;
   type Matrix is array (Positive range <>, Positive range <>) of Small;
   function Count_Even (M : Matrix) return Natural
     with Pre => M'Length (1) <= 100 and M'Length (2) <= 100
   is
      N : Natural := 0;
   begin
      for E of M when E mod 2 = 0 loop
         if N < 10_000 then
            N := N + 1;
         end if;
      end loop;
      return N;
   end Count_Even;
   P : constant Matrix := ((1, 2, 3), (4, 5, 6));
begin
   for E of reverse P loop
      Put (Integer'Image (E));
   end loop;
   New_Line;
   for E of P when E > 2 loop
      Put (Integer'Image (E));
   end loop;
   New_Line;
   for E of reverse P when E mod 2 = 1 loop
      Put (Integer'Image (E));
   end loop;
   New_Line;
   Put_Line (Integer'Image (Count_Even (P)));
end Main;
