Sort stability: Difference between revisions
Content added Content deleted
(Added XPL0 example.) |
(→{{header|TXR}}: Update with new info.) |
||
Line 1,738: | Line 1,738: | ||
=={{header|TXR}}== |
=={{header|TXR}}== |
||
TXR provides a number of sorting functions. <code>sort</code> and <code>nsort</code> (destructive variant) are not stable for vectors and strings, but are stable for lists. |
|||
Straight from the TXR documentation about the <code>sort</code> function: |
|||
The functions <code>ssort</code> and <code>snsort</code> counterparts are stable for all sequence kinds. |
|||
<i>The <code>sort</code> function is stable for sequences which are lists. This means that the original order of items which are considered identical is preserved. For strings and vectors, <code>sort</code> is not stable.</i> |
|||
In addition, there are caching variants of all these functions: <code>csort</code>, <code>cnsort</code>, <code>cssort</code> and <code>csnsort</code>. They respectively have the same stability properties as their counterparts without the leading <code>c</code>. |
|||
TXR Lisp originally had one sorting function called <code>sort</code>, which was destructive, like the <code>sort</code> in Common Lisp. That function was renamed to <code>nsort</code>, and <code>sort</code> became the name of a non-destructive function. That happened in TXR 238, released in May, 2020. |
|||
=={{header|Wren}}== |
=={{header|Wren}}== |