RosettaCodeData/Task/Remove-duplicate-elements/Ada/remove-duplicate-elements.ada

16 lines
376 B
Ada
Raw Permalink Normal View History

2019-09-12 10:33:56 -07:00
with Ada.Containers.Ordered_Sets, Ada.Text_IO;
use Ada.Text_IO;
2016-12-05 22:15:40 +01:00
2019-09-12 10:33:56 -07:00
procedure Duplicate is
package Int_Sets is new Ada.Containers.Ordered_Sets (Integer);
Nums : constant array (Natural range <>) of Integer := (1,2,3,4,5,5,6,7,1);
Unique : Int_Sets.Set;
2016-12-05 22:15:40 +01:00
begin
2019-09-12 10:33:56 -07:00
for n of Nums loop
Unique.Include (n);
end loop;
for e of Unique loop
Put (e'img);
end loop;
end Duplicate;