summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2008-10-06 04:25:24 (GMT)
committerKevin B Kenny <kennykb@acm.org>2008-10-06 04:25:24 (GMT)
commit1a00d8582f1c15d195130ae24310aea2acf2aedd (patch)
tree286ddd1782a1dec9ddf1f79c3f7b1cd1d804f415
parent06d77e88c1820d6b44d1450d66d93d5950779ea8 (diff)
downloadtcl-1a00d8582f1c15d195130ae24310aea2acf2aedd.zip
tcl-1a00d8582f1c15d195130ae24310aea2acf2aedd.tar.gz
tcl-1a00d8582f1c15d195130ae24310aea2acf2aedd.tar.bz2
missed commit of lset.n in TIP #331 changes.
-rw-r--r--ChangeLog1
-rwxr-xr-xdoc/lset.n17
2 files changed, 12 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 085ee28..94fa784 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,7 @@
TIP #331 IMPLEMENTATION
+ * doc/lset.n:
* generic/tclListObj.c (TclLsetFlat):
* tests/lset.test: Modified the [lset] command so that it allows
for an index of 'end+1', which has the effect of appending an
diff --git a/doc/lset.n b/doc/lset.n
index 0e95353..e6966aa 100755
--- a/doc/lset.n
+++ b/doc/lset.n
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: lset.n,v 1.17 2008/07/13 23:15:23 nijtmans Exp $
+'\" RCS: @(#) $Id: lset.n,v 1.18 2008/10/06 04:25:24 kennykb Exp $
'\"
.so man.macros
.TH lset n 8.4 Tcl "Tcl Built-In Commands"
@@ -49,9 +49,12 @@ replaced with \fInewValue\fR. This new list is stored in the
variable \fIvarName\fR, and is also the return value from the \fBlset\fR
command.
.PP
-If \fIindex\fR is negative or greater than or equal to the number
+If \fIindex\fR is negative or greater than the number
of elements in \fI$varName\fR, then an error occurs.
.PP
+If \fIindex\fR is equal to the numnber of elements in \fI$varName\fR,
+then the given element is appended to the list.
+.PP
The interpretation of each simple \fIindex\fR value is the same as
for the command \fBstring index\fR, supporting simple index
arithmetic and indices relative to the end of the list.
@@ -59,7 +62,8 @@ arithmetic and indices relative to the end of the list.
If additional \fIindex\fR arguments are supplied, then each argument is
used in turn to address an element within a sublist designated
by the previous indexing operation,
-allowing the script to alter elements in sublists. The command,
+allowing the script to alter elements in sublists (or append elements
+to sublists). The command,
.CS
lset a 1 2 newValue
.CE
@@ -71,9 +75,10 @@ replaces element 2 of sublist 1 with \fInewValue\fR.
.PP
The integer appearing in each \fIindex\fR argument must be greater
than or equal to zero. The integer appearing in each \fIindex\fR
-argument must be strictly less than the length of the corresponding
-list. In other words, the \fBlset\fR command cannot change the size
-of a list. If an index is outside the permitted range, an error is reported.
+argument must be less than or equal to the length of the corresponding
+list. In other words, the \fBlset\fR command can change the size
+of a list only by appending an element (setting the one after the current
+end). If an index is outside the permitted range, an error is reported.
.SH EXAMPLES
.PP
In each of these examples, the initial value of \fIx\fR is: