RosettaCodeData/Task/Loops-Foreach/Ada/loops-foreach-3.ada

26 lines
541 B
Ada
Raw Permalink Normal View History

2014-01-17 05:32:22 +00:00
with Ada.Integer_Text_IO, Ada.Containers.Doubly_Linked_Lists;
2013-04-10 21:29:02 -07:00
use Ada.Integer_Text_IO, Ada.Containers;
2014-01-17 05:32:22 +00:00
procedure Doubly_Linked_List is
2013-04-10 21:29:02 -07:00
2014-01-17 05:32:22 +00:00
package DL_List_Pkg is new Doubly_Linked_Lists (Integer);
use DL_List_Pkg;
2013-04-10 21:29:02 -07:00
2014-01-17 05:32:22 +00:00
procedure Print_Node (Position : Cursor) is
2013-04-10 21:29:02 -07:00
begin
Put (Element (Position));
2014-01-17 05:32:22 +00:00
end Print_Node;
2013-04-10 21:29:02 -07:00
2014-01-17 05:32:22 +00:00
DL_List : List;
2013-04-10 21:29:02 -07:00
begin
2014-01-17 05:32:22 +00:00
DL_List.Append (1);
DL_List.Append (2);
DL_List.Append (3);
2013-04-10 21:29:02 -07:00
2014-01-17 05:32:22 +00:00
-- Iterates through every node of the list.
DL_List.Iterate (Print_Node'Access);
2013-04-10 21:29:02 -07:00
2014-01-17 05:32:22 +00:00
end Doubly_Linked_List;