summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorpspjuth <peter.spjuth@gmail.com>2018-01-02 23:05:25 (GMT)
committerpspjuth <peter.spjuth@gmail.com>2018-01-02 23:05:25 (GMT)
commitfc03549d341d28a2158b38acb91c75be993d37d0 (patch)
treefe32cc05e720c04d0dcef56bbf8e64cb5bd8306f /doc
parent54590627ee18ff872a23f3a37227324aed8d1fd8 (diff)
downloadtcl-fc03549d341d28a2158b38acb91c75be993d37d0.zip
tcl-fc03549d341d28a2158b38acb91c75be993d37d0.tar.gz
tcl-fc03549d341d28a2158b38acb91c75be993d37d0.tar.bz2
Doc for lsearch -stride
Diffstat (limited to 'doc')
-rw-r--r--doc/lsearch.n19
1 files changed, 19 insertions, 0 deletions
diff --git a/doc/lsearch.n b/doc/lsearch.n
index c2644b8..2f956a5 100644
--- a/doc/lsearch.n
+++ b/doc/lsearch.n
@@ -148,6 +148,18 @@ or \fB\-not\fR.
These options are used to search lists of lists. They may be used
with any other options.
.TP
+\fB\-stride\0\fIstrideLength\fR
+.
+If this option is specified, the list is treated as consisting of
+groups of \fIstrideLength\fR elements and the groups are searched by
+either their first element or, if the \fB\-index\fR option is used,
+by the element within each group given by the first index passed to
+\fB\-index\fR (which is then ignored by \fB\-index\fR). The resulting
+index always points to the first element in a group.
+.PP
+The list length must be an integer multiple of \fIstrideLength\fR, which
+in turn must be at least 2.
+.TP
\fB\-index\fR\0\fIindexList\fR
.
This option is designed for use when searching within nested lists.
@@ -208,6 +220,13 @@ It is also possible to search inside elements:
\fBlsearch\fR -index 1 -all -inline {{a abc} {b bcd} {c cde}} *bc*
\fI\(-> {a abc} {b bcd}\fR
.CE
+.PP
+The same thing for a flattened list:
+.PP
+.CS
+\fBlsearch\fR -stride 2 -index 1 -all -inline {a abc b bcd c cde} *bc*
+ \fI\(-> {a abc b bcd}\fR
+.CE
.SH "SEE ALSO"
foreach(n), list(n), lappend(n), lindex(n), linsert(n), llength(n),
lset(n), lsort(n), lrange(n), lreplace(n),