summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-09-27 13:43:26 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-09-27 13:43:26 (GMT)
commit9634f3a9ed751c24e6089d7cea6d717e599f86ab (patch)
tree59a4fe5deb661b1bfe9418313a43777e9589bee3 /doc
parent80965aae216af54ee6aac60490532b36960b1928 (diff)
parentf68a36c8bedfe75b570af667b2fec7a0d81e8f00 (diff)
downloadtcl-9634f3a9ed751c24e6089d7cea6d717e599f86ab.zip
tcl-9634f3a9ed751c24e6089d7cea6d717e599f86ab.tar.gz
tcl-9634f3a9ed751c24e6089d7cea6d717e599f86ab.tar.bz2
Merge trunk
Diffstat (limited to 'doc')
-rw-r--r--doc/interp.n20
-rw-r--r--doc/lappend.n4
-rw-r--r--doc/lassign.n4
-rw-r--r--doc/ledit.n91
-rw-r--r--doc/lindex.n4
-rw-r--r--doc/linsert.n4
-rw-r--r--doc/list.n4
-rw-r--r--doc/llength.n4
-rw-r--r--doc/lmap.n4
-rw-r--r--doc/lpop.n4
-rw-r--r--doc/lrange.n4
-rw-r--r--doc/lremove.n4
-rw-r--r--doc/lrepeat.n4
-rw-r--r--doc/lreplace.n4
-rw-r--r--doc/lreverse.n4
-rw-r--r--doc/lsearch.n4
-rw-r--r--doc/lseq.n4
-rw-r--r--doc/lset.n4
-rw-r--r--doc/lsort.n4
19 files changed, 135 insertions, 44 deletions
diff --git a/doc/interp.n b/doc/interp.n
index 63d8fc5..7037c65 100644
--- a/doc/interp.n
+++ b/doc/interp.n
@@ -587,16 +587,16 @@ built-in commands:
\fBflush\fR \fBfor\fR \fBforeach\fR \fBformat\fR
\fBgets\fR \fBglobal\fR \fBif\fR \fBincr\fR
\fBinfo\fR \fBinterp\fR \fBjoin\fR \fBlappend\fR
-\fBlassign\fR \fBlindex\fR \fBlinsert\fR \fBlist\fR
-\fBllength\fR \fBlrange\fR \fBlrepeat\fR \fBlreplace\fR
-\fBlsearch\fR \fBlset\fR \fBlsort\fR \fBnamespace\fR
-\fBpackage\fR \fBpid\fR \fBproc\fR \fBputs\fR
-\fBread\fR \fBregexp\fR \fBregsub\fR \fBrename\fR
-\fBreturn\fR \fBscan\fR \fBseek\fR \fBset\fR
-\fBsplit\fR \fBstring\fR \fBsubst\fR \fBswitch\fR
-\fBtell\fR \fBtime\fR \fBtrace\fR \fBunset\fR
-\fBupdate\fR \fBuplevel\fR \fBupvar\fR \fBvariable\fR
-\fBvwait\fR \fBwhile\fR
+\fBlassign\fR \fBledit\fR \fBlindex\fR \fBlinsert\fR
+\fBlist\fR \fBllength\fR \fBlrange\fR \fBlrepeat\fR
+\fBlreplace\fR \fBlsearch\fR \fBlseq\fR \fBlset\fR
+\fBlsort\fR \fBnamespace\fR \fBpackage\fR \fBpid\fR
+\fBproc\fR \fBputs\fR \fBread\fR \fBregexp\fR
+\fBregsub\fR \fBrename\fR \fBreturn\fR \fBscan\fR
+\fBseek\fR \fBset\fR \fBsplit\fR \fBstring\fR
+\fBsubst\fR \fBswitch\fR \fBtell\fR \fBtime\fR
+\fBtrace\fR \fBunset\fR \fBupdate\fR \fBuplevel\fR
+\fBupvar\fR \fBvariable\fR \fBvwait\fR \fBwhile\fR
.DE
The following commands are hidden by \fBinterp create\fR when it
creates a safe interpreter:
diff --git a/doc/lappend.n b/doc/lappend.n
index 89b6909..3fbda79 100644
--- a/doc/lappend.n
+++ b/doc/lappend.n
@@ -49,9 +49,9 @@ Using \fBlappend\fR to build up a list of numbers.
1 2 3 4 5
.CE
.SH "SEE ALSO"
-list(n), lassign(n), lindex(n), linsert(n), llength(n),
+list(n), lassign(n), ledit(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
-lreverse(n), lsearch(n), lset(n), lsort(n)
+lreverse(n), lsearch(n), lseq(n), lset(n), lsort(n)
.SH KEYWORDS
append, element, list, variable
.\" Local variables:
diff --git a/doc/lassign.n b/doc/lassign.n
index 67048ba..d23509a 100644
--- a/doc/lassign.n
+++ b/doc/lassign.n
@@ -52,9 +52,9 @@ command in many shell languages like this:
set ::argv [\fBlassign\fR $::argv argumentToReadOff]
.CE
.SH "SEE ALSO"
-list(n), lappend(n), lindex(n), linsert(n), llength(n),
+list(n), lappend(n), ledit(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
-lreverse(n), lsearch(n), lset(n), lsort(n)
+lreverse(n), lsearch(n), lseq(n), lset(n), lsort(n)
.SH KEYWORDS
assign, element, list, multiple, set, variable
'\"Local Variables:
diff --git a/doc/ledit.n b/doc/ledit.n
new file mode 100644
index 0000000..48e6da5
--- /dev/null
+++ b/doc/ledit.n
@@ -0,0 +1,91 @@
+'\"
+'\" Copyright (c) 2022 Ashok P. Nadkarni <apnmbx-public@yahoo.com>. All rights reserved.
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.TH ledit n 8.7 Tcl "Tcl Built-In Commands"
+.so man.macros
+.BS
+'\" Note: do not modify the .SH NAME line immediately below!
+.SH NAME
+ledit \- Replace elements of a list stored in variable
+.SH SYNOPSIS
+\fBledit \fIlistVar first last \fR?\fIvalue value ...\fR?
+.BE
+.SH DESCRIPTION
+.PP
+The command fetches the list value in variable \fIlistVar\fR and replaces the
+elements in the range given by indices \fIfirst\fR to \fIlast\fR (inclusive)
+with the \fIvalue\fR arguments. The resulting list is then stored back in
+\fIlistVar\fR and returned as the result of the command.
+.PP
+Arguments \fIfirst\fR and \fIlast\fR are index values specifying the first and
+last elements of the range to replace. They are interpreted
+the same as index values for the command \fBstring index\fR,
+supporting simple index arithmetic and indices relative to the
+end of the list. The index 0 refers to the first element of the
+list, and \fBend\fR refers to the last element of the list.
+.PP
+If either \fIfirst\fR or \fIlast\fR is less than zero, it is considered to
+refer to the position before the first element of the list. This allows
+elements to be prepended.
+.PP
+If either \fIfirst\fR or \fIlast\fR indicates a position greater than the
+index of the last element of the list, it is treated as if it is an
+index one greater than the last element. This allows elements to be appended.
+.PP
+If \fIlast\fR is less than \fIfirst\fR, then any specified elements
+will be inserted into the list before the element specified by \fIfirst\fR
+with no elements being deleted.
+.PP
+The \fIvalue\fR arguments specify zero or more new elements to
+be added to the list in place of those that were deleted.
+Each \fIvalue\fR argument will become a separate element of
+the list. If no \fIvalue\fR arguments are specified, then the elements
+between \fIfirst\fR and \fIlast\fR are simply deleted.
+.SH EXAMPLES
+.PP
+Prepend to a list.
+.PP
+.CS
+% set lst {c d e f g}
+c d e f g
+% ledit lst -1 -1 a b
+a b c d e f g
+.CE
+.PP
+Append to the list.
+.PP
+.CS
+% ledit lst end+1 end+1 h i
+a b c d e f g h i
+.CE
+.PP
+Delete third and fourth elements.
+.PP
+.CS
+% ledit lst 2 3
+a b e f g h i
+.CE
+.PP
+Replace two elements with three.
+.PP
+.CS
+% ledit lst 2 3 x y z
+a b x y z g h i
+% set lst
+a b x y z g h i
+.CE
+.PP
+.SH "SEE ALSO"
+list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
+lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
+lreverse(n), lsearch(n), lseq(n), lset(n), lsort(n),
+string(n)
+.SH KEYWORDS
+element, list, replace
+.\" Local variables:
+.\" mode: nroff
+.\" fill-column: 78
+.\" End:
diff --git a/doc/lindex.n b/doc/lindex.n
index 75fe5e8..d4d845d 100644
--- a/doc/lindex.n
+++ b/doc/lindex.n
@@ -115,9 +115,9 @@ set idx 3
\fI\(-> f\fR
.CE
.SH "SEE ALSO"
-list(n), lappend(n), lassign(n), linsert(n), llength(n),
+list(n), lappend(n), lassign(n), ledit(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
-lreverse(n), lsearch(n), lset(n), lsort(n),
+lreverse(n), lsearch(n), lseq(n), lset(n), lsort(n),
string(n)
.SH KEYWORDS
element, index, list
diff --git a/doc/linsert.n b/doc/linsert.n
index 3179256..014f9cd 100644
--- a/doc/linsert.n
+++ b/doc/linsert.n
@@ -45,9 +45,9 @@ set newList [\fBlinsert\fR $midList end-1 lazy]
set newerList [\fBlinsert\fR [\fBlinsert\fR $oldList end-1 quick] 1 lazy]
.CE
.SH "SEE ALSO"
-list(n), lappend(n), lassign(n), lindex(n), llength(n),
+list(n), lappend(n), lassign(n), ledit(n), lindex(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
-lreverse(n), lsearch(n), lset(n), lsort(n),
+lreverse(n), lsearch(n), lseq(n), lset(n), lsort(n),
string(n)
.SH KEYWORDS
element, insert, list
diff --git a/doc/list.n b/doc/list.n
index 3fa1975..08a6fe7 100644
--- a/doc/list.n
+++ b/doc/list.n
@@ -46,9 +46,9 @@ while \fBconcat\fR with the same arguments will return
\fBa b c d e f {g h}\fR
.CE
.SH "SEE ALSO"
-lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
+lappend(n), lassign(n), ledit(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
-lreverse(n), lsearch(n), lset(n), lsort(n)
+lreverse(n), lsearch(n), lseq(n), lset(n), lsort(n)
.SH KEYWORDS
element, list, quoting
'\"Local Variables:
diff --git a/doc/llength.n b/doc/llength.n
index 26824a0..574834f 100644
--- a/doc/llength.n
+++ b/doc/llength.n
@@ -49,9 +49,9 @@ An empty list is not necessarily an empty string:
1,0
.CE
.SH "SEE ALSO"
-list(n), lappend(n), lassign(n), lindex(n), linsert(n),
+list(n), lappend(n), lassign(n), ledit(n), lindex(n), linsert(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
-lreverse(n), lsearch(n), lset(n), lsort(n)
+lreverse(n), lsearch(n), lseq(n), lset(n), lsort(n)
.SH KEYWORDS
element, list, length
'\" Local Variables:
diff --git a/doc/lmap.n b/doc/lmap.n
index 026e9d0..36a0c7c 100644
--- a/doc/lmap.n
+++ b/doc/lmap.n
@@ -78,9 +78,9 @@ set prefix [\fBlmap\fR x $values {expr {
.CE
.SH "SEE ALSO"
break(n), continue(n), for(n), foreach(n), while(n),
-list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
+list(n), lappend(n), lassign(n), ledit(n), lindex(n), linsert(n), llength(n),
lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
-lreverse(n), lsearch(n), lset(n), lsort(n)
+lreverse(n), lsearch(n), lseq(n), lset(n), lsort(n)
.SH KEYWORDS
foreach, iteration, list, loop, map
'\" Local Variables:
diff --git a/doc/lpop.n b/doc/lpop.n
index 3d88638..2a464eb 100644
--- a/doc/lpop.n
+++ b/doc/lpop.n
@@ -86,9 +86,9 @@ The indicated value becomes the new value of \fIx\fR.
\fI\(-> {{a b} {c d}} {{e f} h}\fR
.CE
.SH "SEE ALSO"
-list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
+list(n), lappend(n), lassign(n), ledit(n), lindex(n), linsert(n), llength(n),
lmap(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
-lreverse(n), lsearch(n), lset(n), lsort(n),
+lreverse(n), lsearch(n), lseq(n), lset(n), lsort(n),
string(n)
.SH KEYWORDS
element, index, list, remove, pop, stack, queue
diff --git a/doc/lrange.n b/doc/lrange.n
index 0d4b261..38c4abf 100644
--- a/doc/lrange.n
+++ b/doc/lrange.n
@@ -71,9 +71,9 @@ elements to
{elements to}
.CE
.SH "SEE ALSO"
-list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
+list(n), lappend(n), lassign(n), ledit(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lremove(n), lrepeat(n), lreplace(n),
-lreverse(n), lsearch(n), lset(n), lsort(n),
+lreverse(n), lsearch(n), lseq(n), lset(n), lsort(n),
string(n)
.SH KEYWORDS
element, list, range, sublist
diff --git a/doc/lremove.n b/doc/lremove.n
index 59d261b..8763ea6 100644
--- a/doc/lremove.n
+++ b/doc/lremove.n
@@ -46,9 +46,9 @@ Removing the same element indicated in two different ways:
a b d e
.CE
.SH "SEE ALSO"
-list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
+list(n), lappend(n), lassign(n), ledit(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lrepeat(n), lreplace(n),
-lreverse(n), lsearch(n), lset(n), lsort(n)
+lreverse(n), lsearch(n), lseq(n), lset(n), lsort(n)
.SH KEYWORDS
element, list, remove
.\" Local variables:
diff --git a/doc/lrepeat.n b/doc/lrepeat.n
index 9a3fc88..cd672db 100644
--- a/doc/lrepeat.n
+++ b/doc/lrepeat.n
@@ -32,9 +32,9 @@ is identical to \fBlist element ...\fR.
\fI\(-> {a a} b c {a a} b c {a a} b c\fR
.CE
.SH "SEE ALSO"
-list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
+list(n), lappend(n), lassign(n), ledit(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lreplace(n),
-lreverse(n), lsearch(n), lset(n), lsort(n)
+lreverse(n), lsearch(n), lseq(n), lset(n), lsort(n)
.SH KEYWORDS
element, index, list
'\" Local Variables:
diff --git a/doc/lreplace.n b/doc/lreplace.n
index bc9d7ca..47d33f9 100644
--- a/doc/lreplace.n
+++ b/doc/lreplace.n
@@ -95,9 +95,9 @@ a b c d e f g h i
.CE
.VE TIP505
.SH "SEE ALSO"
-list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
+list(n), lappend(n), lassign(n), ledit(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n),
-lreverse(n), lsearch(n), lset(n), lsort(n),
+lreverse(n), lsearch(n), lseq(n), lset(n), lsort(n),
string(n)
.SH KEYWORDS
element, list, replace
diff --git a/doc/lreverse.n b/doc/lreverse.n
index e2e3b69..bb0703d 100644
--- a/doc/lreverse.n
+++ b/doc/lreverse.n
@@ -25,9 +25,9 @@ input list, \fIlist\fR, except with the elements in the reverse order.
\fI\(-> f e {c d} b a\fR
.CE
.SH "SEE ALSO"
-list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
+list(n), lappend(n), lassign(n), ledit(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
-lsearch(n), lset(n), lsort(n)
+lsearch(n), lseq(n), lset(n), lsort(n)
.SH KEYWORDS
element, list, reverse
'\" Local Variables:
diff --git a/doc/lsearch.n b/doc/lsearch.n
index 72c91dc..c8d2ec9 100644
--- a/doc/lsearch.n
+++ b/doc/lsearch.n
@@ -229,9 +229,9 @@ The same thing for a flattened list:
.CE
.SH "SEE ALSO"
foreach(n),
-list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
+list(n), lappend(n), lassign(n), ledit(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
-lreverse(n), lset(n), lsort(n),
+lreverse(n), lseq(n), lset(n), lsort(n),
string(n)
.SH KEYWORDS
binary search, linear search,
diff --git a/doc/lseq.n b/doc/lseq.n
index 5c7d03b..df8a8bc 100644
--- a/doc/lseq.n
+++ b/doc/lseq.n
@@ -81,8 +81,8 @@ must be numeric; a non-numeric string will result in an error.
.\"
.CE
.SH "SEE ALSO"
-foreach(n), list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
-lmap(n), lpop(n), lrange(n), lremove(n), lreplace(n),
+foreach(n), list(n), lappend(n), lassign(n), ledit(n), lindex(n), linsert(n),
+llength(n), lmap(n), lpop(n), lrange(n), lremove(n), lreplace(n),
lreverse(n), lsearch(n), lset(n), lsort(n)
.SH KEYWORDS
element, index, list
diff --git a/doc/lset.n b/doc/lset.n
index cb60ee0..666fc1a 100644
--- a/doc/lset.n
+++ b/doc/lset.n
@@ -138,9 +138,9 @@ The indicated return value also becomes the new value of \fIx\fR.
\fI\(-> {{a b} {c d}} {{e f} {j h}}\fR
.CE
.SH "SEE ALSO"
-list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
+list(n), lappend(n), lassign(n), ledit(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
-lreverse(n), lsearch(n), lsort(n)
+lreverse(n), lsearch(n), lseq(n), lsort(n)
string(n)
.SH KEYWORDS
element, index, list, replace, set
diff --git a/doc/lsort.n b/doc/lsort.n
index 2018e30..1695ea8 100644
--- a/doc/lsort.n
+++ b/doc/lsort.n
@@ -264,9 +264,9 @@ More complex sorting using a comparison function:
{1 dingo} {2 banana} {0x2 carrot} {3 apple}
.CE
.SH "SEE ALSO"
-list(n), lappend(n), lassign(n), lindex(n), linsert(n), llength(n),
+list(n), lappend(n), lassign(n), ledit(n), lindex(n), linsert(n), llength(n),
lmap(n), lpop(n), lrange(n), lremove(n), lrepeat(n), lreplace(n),
-lreverse(n), lsearch(n), lset(n)
+lreverse(n), lsearch(n), lseq(n), lset(n)
.SH KEYWORDS
element, list, order, sort
'\" Local Variables: