Sorting algorithms/Insertion sort: Difference between revisions
m
→{{header|Binary Lambda Calculus}}
imported>StraightDoubt m (→AArch64 Assembly: Slightly improved efficiency of my previous edition) |
|||
(One intermediate revision by one other user not shown) | |||
Line 1,811:
As documented at https://github.com/tromp/AIT/blob/master/lists/sort.lam, the 55 byte BLC program
<
sorts a list of bitstrings, such as integers of a fixed bit-width, lexicographically.
Line 4,713:
[12-Jan-2014 11-Jan-2015 12-Jan-2015 11-Jan-2016]
</pre>
=={{header|Refal}}==
<syntaxhighlight lang="refal">$ENTRY Go {
, 7 6 5 9 8 4 3 1 2 0: e.Arr
= <Prout e.Arr>
<Prout <Sort e.Arr>>;
};
Sort {
(e.S) = e.S;
(e.S) s.I e.X = <Sort (<Insert s.I e.S>) e.X>;
e.X = <Sort () e.X>;
};
Insert {
s.N = s.N;
s.N s.M e.X, <Compare s.N s.M>: {
'+' = s.M <Insert s.N e.X>;
s.C = s.N s.M e.X;
};
};</syntaxhighlight>
{{out}}
<pre>7 6 5 9 8 4 3 1 2 0
0 1 2 3 4 5 6 7 8 9</pre>
=={{header|REXX}}==
|