米国国防省の標準高等言語エイダ(Ada)を語れ!

このエントリーをはてなブックマークに追加
575デフォルトの名無しさん
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure NSort is
N : Natural;
begin
Get(N);
declare
Used : array (1 .. N) of Boolean := (others => False);
procedure Rec(F : Natural; Par : not null access procedure) is
begin
if F < N then
for I in Used'Range loop
if not Used(I) then
declare
procedure P is
begin
Par.all; Put(I, 2);
end;
begin
Used(I) := True; Rec(F + 1, P'Access); Used(I) := False;
end;
end if;
end loop;
else
Par.all; New_Line;
end if;
end Rec;
procedure Prompt is begin Put('>'); end Prompt;
begin Rec(0, Prompt'Access); end;
end NSort;