Time for an 2014 update…

This commit is contained in:
Ingy döt Net 2014-01-17 05:32:22 +00:00
parent 372c577f83
commit 09687c4926
2520 changed files with 34227 additions and 7318 deletions

View file

@ -8,7 +8,7 @@ procedure For_Each is
begin
for Num in A'Range loop
put( A (Num) );
Put( A (Num) );
end loop;
end For_Each;

View file

@ -1,25 +1,3 @@
with Ada.Integer_Text_IO, Ada.Containers.Doubly_Linked_Lists;
use Ada.Integer_Text_IO, Ada.Containers;
procedure Doubly_Linked_List is
package DL_List_Pkg is new Doubly_Linked_Lists (Integer);
use DL_List_Pkg;
procedure Print_Node (Position : Cursor) is
begin
Put (Element (Position));
end Print_Node;
DL_List : List;
begin
DL_List.Append (1);
DL_List.Append (2);
DL_List.Append (3);
-- Iterates through every node of the list.
DL_List.Iterate (Print_Node'Access);
end Doubly_Linked_List;
for Item of A loop
Put( Item );
end loop;

View file

@ -1,25 +1,25 @@
with Ada.Integer_Text_IO, Ada.Containers.Vectors;
with Ada.Integer_Text_IO, Ada.Containers.Doubly_Linked_Lists;
use Ada.Integer_Text_IO, Ada.Containers;
procedure Vector_Example is
procedure Doubly_Linked_List is
package Vector_Pkg is new Vectors (Natural, Integer);
use Vector_Pkg;
package DL_List_Pkg is new Doubly_Linked_Lists (Integer);
use DL_List_Pkg;
procedure Print_Element (Position : Cursor) is
procedure Print_Node (Position : Cursor) is
begin
Put (Element (Position));
end Print_Element;
end Print_Node;
V : Vector;
DL_List : List;
begin
V.Append (1);
V.Append (2);
V.Append (3);
DL_List.Append (1);
DL_List.Append (2);
DL_List.Append (3);
-- Iterates through every element of the vector.
V.Iterate (Print_Element'Access);
-- Iterates through every node of the list.
DL_List.Iterate (Print_Node'Access);
end Vector_Example;
end Doubly_Linked_List;

View file

@ -0,0 +1,25 @@
with Ada.Integer_Text_IO, Ada.Containers.Vectors;
use Ada.Integer_Text_IO, Ada.Containers;
procedure Vector_Example is
package Vector_Pkg is new Vectors (Natural, Integer);
use Vector_Pkg;
procedure Print_Element (Position : Cursor) is
begin
Put (Element (Position));
end Print_Element;
V : Vector;
begin
V.Append (1);
V.Append (2);
V.Append (3);
-- Iterates through every element of the vector.
V.Iterate (Print_Element'Access);
end Vector_Example;

View file

@ -0,0 +1,16 @@
for p in AlternatingGroup(4) do
Print(p, "\n");
od;
()
(1,3,2)
(1,2,3)
(1,4,3)
(2,4,3)
(1,3)(2,4)
(1,2,4)
(1,4)(2,3)
(2,3,4)
(1,3,4)
(1,2)(3,4)
(1,4,2)

View file

@ -0,0 +1,3 @@
for i in collection
println(i)
end