From: Shark8 on
I'm having some trouble with a Shell Sort I'm writing; I think I
screwed up the internal insertion sort.

Type ARR is Array (Integer Range <>) of Integer;

Procedure Sort( Input : in out ARR ) is
Gaps : constant array(Positive Range <>) of Integer:=
(1, 4, 10, 23, 57, 132, 301, 701, 1750);

Initial_Gap_Index : Integer;
begin
If Input'Length > 1 then

For Index in reverse Gaps'Range loop
Initial_Gap_Index:= Index;
exit when Gaps(Initial_Gap_Index) < Input'Length;
end loop;

For GapIndex in reverse Gaps'First..Initial_Gap_Index loop
declare
Inc : Integer:= Gaps(GapIndex);
Index : Integer;
Temp : Integer;
begin
For Gap_Index in Input'First..Input'Last-Inc loop
Index:= Gap_Index;
Temp:= Input(Index);
while Index+Inc in Input'Range loop

if Temp >= Input(Index+Inc) then
Swap( Input, Index, Index+Inc );
end if;
Index:= Index + Inc;
end loop;
end loop;
end;
end loop;

end if;
end Sort;
From: Shark8 on
Never mind, I fixed it.

Procedure Sort( Input : in out ARR ) is
Gaps : constant array(Positive Range <>) of Integer:=
(1, 4, 10, 23, 57, 132, 301, 701, 1750);

Initial_Gap_Index : Integer;
begin
If Input'Length > 1 then

For Index in reverse Gaps'Range loop
Initial_Gap_Index:= Index;
exit when Gaps(Initial_Gap_Index) < Input'Length;
end loop;

For GapIndex in reverse Gaps'First..Initial_Gap_Index loop
Insertion:
declare
Inc : Integer:= Gaps(GapIndex);
Next : Integer;
Done : Boolean;
begin
while True loop
Done:= True;
For Index in Input'First..Input'Last-Inc loop --
First Element
Next:= Index + Inc; -- Next Element
if Input(Next) < Input(Index) then
Swap(Input, Index, Next); -- Not finished
Done:= False; -- ...keep goin`
end if;
end loop;
Exit When Done;
end loop;
end Insertion;
end loop;
end if;
end Sort;