summaryrefslogtreecommitdiffstats
path: root/doc/lsearch.n
diff options
context:
space:
mode:
authorericm <ericm>2000-05-09 17:50:38 (GMT)
committerericm <ericm>2000-05-09 17:50:38 (GMT)
commita406bb38849430633c8cfb33dceac73e8a7903c4 (patch)
tree4f7c1988a264961da2e766d9c6fbc70cddb7627c /doc/lsearch.n
parent427c904742d9d5aec8068fce38a28be9ae65af08 (diff)
downloadtcl-a406bb38849430633c8cfb33dceac73e8a7903c4.zip
tcl-a406bb38849430633c8cfb33dceac73e8a7903c4.tar.gz
tcl-a406bb38849430633c8cfb33dceac73e8a7903c4.tar.bz2
* tests/lsearch.test:
* doc/lsearch.n: * generic/tclCmdIL.c (Tcl_LsearchObjCmd): Extended [lsearch] to support sorted list searching and typed list searching. [RFE: 4098].
Diffstat (limited to 'doc/lsearch.n')
-rw-r--r--doc/lsearch.n52
1 files changed, 44 insertions, 8 deletions
diff --git a/doc/lsearch.n b/doc/lsearch.n
index 39eddac..2e2024e 100644
--- a/doc/lsearch.n
+++ b/doc/lsearch.n
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: lsearch.n,v 1.3 1999/06/24 21:15:13 jpeek Exp $
+'\" RCS: @(#) $Id: lsearch.n,v 1.4 2000/05/09 17:50:38 ericm Exp $
'\"
.so man.macros
.TH lsearch n 7.0 Tcl "Tcl Built-In Commands"
@@ -14,33 +14,69 @@
.SH NAME
lsearch \- See if a list contains a particular element
.SH SYNOPSIS
-\fBlsearch \fR?\fImode\fR? \fIlist pattern\fR
+\fBlsearch \fR?\fIoptions\fR? \fIlist pattern\fR
.BE
.SH DESCRIPTION
.PP
This command searches the elements of \fIlist\fR to see if one
-of them matches \fIpattern\fR.
-If so, the command returns the index of the first matching
-element.
-If not, the command returns \fB\-1\fR.
-The \fImode\fR argument indicates how the elements of the list are to
+of them matches \fIpattern\fR. If so, the command returns the index
+of the first matching element. If not, the command returns \fB\-1\fR.
+The \fIoption\fR arguments indicates how the elements of the list are to
be matched against \fIpattern\fR and it must have one of the following
values:
.TP
+\fB\-ascii\fR
+The list elements are to be examined as ASCII strings. This option is only
+meaningful when used with \fB\-exact\fR or \fB\-sorted\fR.
+.TP
+\fB\-decreasing\fR
+The list elements are sorted in decreasing order. This option is only
+meaningful when used with \fB\-sorted\fR.
+.TP
+\fB\-dictionary\fR
+The list elements are to be compared using dictionary-style
+comparisons. This option is only meaningful when used with
+\fB\-exact\fR or \fB\-sorted\fR.
+.TP
\fB\-exact\fR
The list element must contain exactly the same string as \fIpattern\fR.
.TP
+\fB\-increasing\fR
+The list elements are sorted in increasing order. This option is only
+meaningful when used with \fB\-sorted\fR.
+.TP
+\fB\-integer\fR
+The list elements are to be compared as integers. This option is only
+meaningful when used with \fB\-exact\fR or \fB\-sorted\fR.
+.TP
\fB\-glob\fR
\fIPattern\fR is a glob-style pattern which is matched against each list
element using the same rules as the \fBstring match\fR command.
.TP
+\fB\-real\fR
+The list elements are to be compared as floating-point values. This
+option is only meaningful when used with \fB\-exact\fR or \fB\-sorted\fR.
+.TP
\fB\-regexp\fR
\fIPattern\fR is treated as a regular expression and matched against
each list element using the rules described in the \fBre_syntax\fR
reference page.
+.TP
+\fB\-sorted\fR
+The list elements are in sorted order. If this option is specified,
+\fBlsearch\fR will use a more efficient searching algorithm to search
+\fIlist\fR. If no other options are specified, \fIlist\fR is assumed
+to be sorted in increasing order, and to contain ASCII strings. This
+option cannot be used with \fB\-glob\fR or \fB\-regexp\fR.
.PP
-If \fImode\fR is omitted then it defaults to \fB\-glob\fR.
+If \fIoption\fR is omitted then it defaults to \fB\-glob\fR. If more
+than one of \fB\-exact\fR, \fB\-glob\fR, \fB\-regexp\fR, and
+\fB\-sorted\fR is specified, whichever option is specified last takes
+precendence. If more than one of \fB\-ascii\fR, \fB\-dictionary\fR,
+\fB\-integer\fR and \fB\-real\fR is specified, the option specified
+last takes precendence. If more than one of \fB\-increasing\fR and
+\fB\-decreasing\fR is specified, the option specified last takes precedence.
.SH KEYWORDS
list, match, pattern, regular expression, search, string