summaryrefslogtreecommitdiffstats
path: root/doc/apply.n
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-10-26 20:11:50 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-10-26 20:11:50 (GMT)
commit6b9dd216db20bac6c76552a6193d67a01e1d34ee (patch)
treeb86166558de62f70eef1a7524fac75f7b47a4f44 /doc/apply.n
parent236c395276f8f1cf4d5b745ea490b4966e6eb148 (diff)
downloadtcl-6b9dd216db20bac6c76552a6193d67a01e1d34ee.zip
tcl-6b9dd216db20bac6c76552a6193d67a01e1d34ee.tar.gz
tcl-6b9dd216db20bac6c76552a6193d67a01e1d34ee.tar.bz2
* changes: Updated for 8.5b2 release.core_8_5_b2
* doc/*.1: Revert doc changes that broke * doc/*.3: `make html` so we can get the release * doc/*.n: out the door.
Diffstat (limited to 'doc/apply.n')
-rw-r--r--doc/apply.n13
1 files changed, 4 insertions, 9 deletions
diff --git a/doc/apply.n b/doc/apply.n
index 8b5b3ee..1e69e69 100644
--- a/doc/apply.n
+++ b/doc/apply.n
@@ -41,8 +41,7 @@ The invocation of \fBapply\fR adds a call frame to Tcl's evaluation stack
proceeds in this call frame, in the namespace given by \fInamespace\fR or
in the global namespace if none was specified. If given, \fInamespace\fR is
interpreted relative to the global namespace even if its name does not start
-with
-.QW :: .
+with '::'.
.PP
The semantics of \fBapply\fR can also be described by:
.PP
@@ -66,7 +65,6 @@ proc apply {fun args} {
This shows how to make a simple general command that applies a transformation
to each element of a list.
.CS
-.ta 2i
proc map {lambda list} {
set result {}
foreach $item $list {
@@ -75,24 +73,21 @@ proc map {lambda list} {
return $result
}
map {x {return [string length $x]:$x}} {a bb ccc dddd}
- \fB\(->\fI 1:a 2:bb 3:ccc 4:dddd\fR
+ \fI=> 1:a 2:bb 3:ccc 4:dddd\fR
map {x {expr {$x**2 + 3*$x - 2}}} {-4 -3 -2 -1 0 1 2 3 4}
- \fB\(->\fI 2 -2 -4 -4 -2 2 8 16 26\fR
+ \fI=> 2 -2 -4 -4 -2 2 8 16 26\fR
.CE
.PP
The \fBapply\fR command is also useful for defining callbacks for use in the
\fBtrace\fR command:
.CS
-.ta 2i
set vbl "123abc"
trace add variable vbl write {\fBapply\fR {v1 v2 op} {
upvar 1 $v1 v
- puts "updated variable to \e"$v\e""
+ puts "updated variable to \\"$v\\""
}}
set vbl 123
- \fB\(->\fI updated variable to "123"\fR
set vbl abc
- \fB\(->\fI updated variable to "abc"\fR
.CE
.SH "SEE ALSO"
proc(n), uplevel(n)