diff options
Diffstat (limited to 'tcl/doc/lsort.n')
-rw-r--r-- | tcl/doc/lsort.n | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/tcl/doc/lsort.n b/tcl/doc/lsort.n index bd3ed1e1a46..6f609384db5 100644 --- a/tcl/doc/lsort.n +++ b/tcl/doc/lsort.n @@ -1,6 +1,7 @@ '\" '\" Copyright (c) 1993 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. +'\" Copyright (c) 1999 Scriptics Corporation '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -8,7 +9,7 @@ '\" RCS: @(#) $Id$ '\" .so man.macros -.TH lsort n 8.0 Tcl "Tcl Built-In Commands" +.TH lsort n 8.3 Tcl "Tcl Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME @@ -20,16 +21,17 @@ lsort \- Sort the elements of a list .SH DESCRIPTION .PP This command sorts the elements of \fIlist\fR, returning a new -list in sorted order. By default ASCII sorting is used with -the result returned in increasing order. -However, any of the -following options may be specified before \fIlist\fR to -control the sorting process (unique abbreviations are accepted): +list in sorted order. The implementation of the \fBlsort\fR command +uses the merge\-sort algorithm which is a stable sort that has O(n log +n) performance characteristics. +.PP +By default ASCII sorting is used with the result returned in +increasing order. However, any of the following options may be +specified before \fIlist\fR to control the sorting process (unique +abbreviations are accepted): .TP 20 \fB\-ascii\fR -Use string comparison with ASCII collation order. This is -the default. -.VS 8.0 br +Use string comparison with ASCII collation order. This is the default. .TP 20 \fB\-dictionary\fR Use dictionary-style comparison. This is the same as \fB\-ascii\fR @@ -38,14 +40,12 @@ strings contain embedded numbers, the numbers compare as integers, not characters. For example, in \fB\-dictionary\fR mode, \fBbigBoy\fR sorts between \fBbigbang\fR and \fBbigboy\fR, and \fBx10y\fR sorts between \fBx9y\fR and \fBx11y\fR. -.VE .TP 20 \fB\-integer\fR Convert list elements to integers and use integer comparison. .TP 20 \fB\-real\fR -Convert list elements to floating-point values and use floating -comparison. +Convert list elements to floating-point values and use floating comparison. .TP 20 \fB\-command\0\fIcommand\fR Use \fIcommand\fR as a comparison command. @@ -62,7 +62,6 @@ This is the default. .TP 20 \fB\-decreasing\fR Sort the list in decreasing order (``largest'' items first). -.VS 8.0 br .TP 20 \fB\-index\0\fIindex\fR If this option is specified, each of the elements of \fIlist\fR must @@ -78,8 +77,16 @@ returns \fB{Second 18} {First 24} {Third 30}\fR. This option is much more efficient than using \fB\-command\fR to achieve the same effect. .RE +.VS 8.3 +.TP 20 +\fB\-unique\fR +If this option is specified, then only the last set of duplicate +elements found in the list will be retained. Note that duplicates are +determined relative to the comparison used in the sort. Thus if +\fI-index 0\fR is used, \fB{1 a}\fR and \fB{1 b}\fR would be +considered duplicates and only the second element, \fB{1 b}\fR, would +be retained. .VE - .SH KEYWORDS element, list, order, sort |