package body Shell is -- sequence from Marcin Ciura, 2001 Gaps : array (Positive range 1 .. 8) of Integer := (701, 301, 132, 57, 23, 10, 4, 1); procedure Sort(Arr : in out Array_T) is Temp : Element_T; Place : Integer; begin if Arr'Length <= 1 then return; end if; for G of Gaps loop for I in Integer range (Index_T'Pos(Arr'First) + G) .. Index_T'Pos(Arr'Last) loop Place := I; Temp := Arr(Index_T'Val(Place)); while Place >= (Index_T'Pos(Arr'First) + G) and then Arr(Index_T'Val(Place - G)) > Temp loop Arr(Index_T'Val(Place)) := Arr(Index_T'Val(Place - G)); Place := Place - G; end loop; Arr(Index_T'Val(Place)) := Temp; end loop; end loop; end Sort; end Shell;