OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tcl/] [doc/] [lsort.n] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1993 The Regents of the University of California.
3
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
4
'\"
5
'\" See the file "license.terms" for information on usage and redistribution
6
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7
'\"
8
'\" RCS: @(#) $Id: lsort.n,v 1.1.1.1 2002-01-16 10:25:24 markom Exp $
9
'\"
10
.so man.macros
11
.TH lsort n 8.0 Tcl "Tcl Built-In Commands"
12
.BS
13
'\" Note:  do not modify the .SH NAME line immediately below!
14
.SH NAME
15
lsort \- Sort the elements of a list
16
.SH SYNOPSIS
17
\fBlsort \fR?\fIoptions\fR? \fIlist\fR
18
.BE
19
 
20
.SH DESCRIPTION
21
.PP
22
This command sorts the elements of \fIlist\fR, returning a new
23
list in sorted order.  By default ASCII sorting is used with
24
the result returned in increasing order.
25
However, any of the
26
following options may be specified before \fIlist\fR to
27
control the sorting process (unique abbreviations are accepted):
28
.TP 20
29
\fB\-ascii\fR
30
Use string comparison with ASCII collation order.  This is
31
the default.
32
.VS 8.0 br
33
.TP 20
34
\fB\-dictionary\fR
35
Use dictionary-style comparison.  This is the same as \fB\-ascii\fR
36
except (a) case is ignored except as a tie-breaker and (b) if two
37
strings contain embedded numbers, the numbers compare as integers,
38
not characters.  For example, in \fB\-dictionary\fR mode, \fBbigBoy\fR
39
sorts between \fBbigbang\fR and \fBbigboy\fR, and \fBx10y\fR
40
sorts between \fBx9y\fR and \fBx11y\fR.
41
.VE
42
.TP 20
43
\fB\-integer\fR
44
Convert list elements to integers and use integer comparison.
45
.TP 20
46
\fB\-real\fR
47
Convert list elements to floating-point values and use floating
48
comparison.
49
.TP 20
50
\fB\-command\0\fIcommand\fR
51
Use \fIcommand\fR as a comparison command.
52
To compare two elements, evaluate a Tcl script consisting of
53
\fIcommand\fR with the two elements appended as additional
54
arguments.  The script should return an integer less than,
55
equal to, or greater than zero if the first element is to
56
be considered less than, equal to, or greater than the second,
57
respectively.
58
.TP 20
59
\fB\-increasing\fR
60
Sort the list in increasing order (``smallest'' items first).
61
This is the default.
62
.TP 20
63
\fB\-decreasing\fR
64
Sort the list in decreasing order (``largest'' items first).
65
.VS 8.0 br
66
.TP 20
67
\fB\-index\0\fIindex\fR
68
If this option is specified, each of the elements of \fIlist\fR must
69
itself be a proper Tcl sublist.  Instead of sorting based on whole sublists,
70
\fBlsort\fR will extract the \fIindex\fR'th element from each sublist
71
and sort based on the given element.  The keyword \fBend\fP is allowed
72
for the \fIindex\fP to sort on the last sublist element. For example,
73
.RS
74
.CS
75
lsort -integer -index 1 {{First 24} {Second 18} {Third 30}}
76
.CE
77
returns \fB{Second 18} {First 24} {Third 30}\fR.
78
This option is much more efficient than using \fB\-command\fR
79
to achieve the same effect.
80
.RE
81
.VE
82
 
83
 
84
.SH KEYWORDS
85
element, list, order, sort

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.