summaryrefslogtreecommitdiffstats
path: root/doc/lsort.n
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2008-06-29 22:28:20 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2008-06-29 22:28:20 (GMT)
commit131a59f68c8b1673c1fcd9b035bb7791eea72bc9 (patch)
treecdb9d2219449fc94b2623bab245f0b0cdcf45c52 /doc/lsort.n
parent7b7bac281c6cba5b97c0962a4032cc39dcc6308f (diff)
downloadtcl-131a59f68c8b1673c1fcd9b035bb7791eea72bc9.zip
tcl-131a59f68c8b1673c1fcd9b035bb7791eea72bc9.tar.gz
tcl-131a59f68c8b1673c1fcd9b035bb7791eea72bc9.tar.bz2
Prepare Tcl's docs for life as 8.6 (remove out of date change bars, fix
typedefs, add a few missing bits)
Diffstat (limited to 'doc/lsort.n')
-rw-r--r--doc/lsort.n24
1 files changed, 12 insertions, 12 deletions
diff --git a/doc/lsort.n b/doc/lsort.n
index e2f4c15..ec80885 100644
--- a/doc/lsort.n
+++ b/doc/lsort.n
@@ -7,7 +7,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: lsort.n,v 1.29 2008/03/26 09:59:22 dkf Exp $
+'\" RCS: @(#) $Id: lsort.n,v 1.30 2008/06/29 22:28:24 dkf Exp $
'\"
.so man.macros
.TH lsort n 8.5 Tcl "Tcl Built-In Commands"
@@ -18,7 +18,6 @@ lsort \- Sort the elements of a list
.SH SYNOPSIS
\fBlsort \fR?\fIoptions\fR? \fIlist\fR
.BE
-
.SH DESCRIPTION
.PP
This command sorts the elements of \fIlist\fR, returning a new
@@ -32,10 +31,12 @@ specified before \fIlist\fR to control the sorting process (unique
abbreviations are accepted):
.TP 20
\fB\-ascii\fR
+.
Use string comparison with Unicode code-point collation order (the
name is for backward-compatibility reasons.) This is the default.
.TP 20
\fB\-dictionary\fR
+.
Use dictionary-style comparison. This is the same as \fB\-ascii\fR
except (a) case is ignored except as a tie-breaker and (b) if two
strings contain embedded numbers, the numbers compare as integers,
@@ -44,12 +45,15 @@ sorts between \fBbigbang\fR and \fBbigboy\fR, and \fBx10y\fR
sorts between \fBx9y\fR and \fBx11y\fR.
.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.
.TP 20
\fB\-command\0\fIcommand\fR
+.
Use \fIcommand\fR as a comparison command.
To compare two elements, evaluate a Tcl script consisting of
\fIcommand\fR with the two elements appended as additional
@@ -59,29 +63,29 @@ be considered less than, equal to, or greater than the second,
respectively.
.TP 20
\fB\-increasing\fR
+.
Sort the list in increasing order
.PQ smallest "items first" .
This is the default.
.TP 20
\fB\-decreasing\fR
+.
Sort the list in decreasing order
.PQ largest "items first" .
.TP 20
\fB\-indices\fR
-.VS "8.5 (TIP#217)"
+.
Return a list of indices into \fIlist\fR in sorted order instead of
the values themselves.
-.VE "8.5 (TIP#217)"
.TP 20
\fB\-index\0\fIindexList\fR
+.
If this option is specified, each of the elements of \fIlist\fR must
itself be a proper Tcl sublist. Instead of sorting based on whole
sublists, \fBlsort\fR will extract the \fIindexList\fR'th element from
each sublist
-.VS 8.5
(as if the overall element and the \fIindexList\fR were passed to
\fBlindex\fR) and sort based on the given element.
-.VE 8.5
For example,
.RS
.CS
@@ -97,7 +101,6 @@ lsort -index end-1 \e
{{a 1 e i} {b 2 3 f g} {c 4 5 6 d h}}
.CE
returns \fB{c 4 5 6 d h} {a 1 e i} {b 2 3 f g}\fR,
-.VS 8.5
and
.CS
lsort -index {0 1} {
@@ -108,19 +111,18 @@ lsort -index {0 1} {
.CE
returns \fB{{d e m o} 34512} {{b i g} 12345} {{c o d e} 54321}\fR
(because \fBe\fR sorts before \fBi\fR which sorts before \fBo\fR.)
-.VE 8.5
This option is much more efficient than using \fB\-command\fR
to achieve the same effect.
.RE
-.VS 8.5
.TP 20
\fB\-nocase\fR
+.
Causes comparisons to be handled in a case-insensitive manner. Has no
effect if combined with the \fB\-dictionary\fR, \fB\-integer\fR, or
\fB\-real\fR options.
-.VE 8.5
.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
@@ -200,10 +202,8 @@ More complex sorting using a comparison function:
{{3 apple} {0x2 carrot} {1 dingo} {2 banana}}
{1 dingo} {2 banana} {0x2 carrot} {3 apple}
.CE
-
.SH "SEE ALSO"
list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n),
lset(n), lrange(n), lreplace(n)
-
.SH KEYWORDS
element, list, order, sort