Sorting algorithms/Insertion sort: Difference between revisions

Line 951:
 
===For arrays whose elements may be of linear type===
 
If the elements of the array may be of linear type, then it becomes necessary to compare the elements by reference. Furthermore it is necessary to break down the array's view, to obtain views of the elements to be compared. Here, as in the simpler implementation for non-linear elements, I use '''array_subcirculate''' to insert an element into its correct position.
 
(The complications are necessary to prevent us accidentally having two copies of a linear value.)
 
<lang ATS>#include "share/atspre_staload.hats"
1,448

edits