diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2007-11-01 23:36:46 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2007-11-01 23:36:46 (GMT) |
commit | c7d4f0143c9004a2ad087ba1faf97eaec526c3e2 (patch) | |
tree | b14613647bccdf8360da6c3a755b0ab6d29b5279 /doc | |
parent | 8700b04b46fb89254c0ce1489142dd0a7bf68702 (diff) | |
download | tcl-c7d4f0143c9004a2ad087ba1faf97eaec526c3e2.zip tcl-c7d4f0143c9004a2ad087ba1faf97eaec526c3e2.tar.gz tcl-c7d4f0143c9004a2ad087ba1faf97eaec526c3e2.tar.bz2 |
Minor documentation improvements
Diffstat (limited to 'doc')
-rw-r--r-- | doc/apply.n | 4 | ||||
-rw-r--r-- | doc/join.n | 6 | ||||
-rw-r--r-- | doc/lindex.n | 32 | ||||
-rw-r--r-- | doc/lrepeat.n | 14 | ||||
-rw-r--r-- | doc/lreverse.n | 8 | ||||
-rw-r--r-- | doc/lsearch.n | 32 | ||||
-rwxr-xr-x | doc/lset.n | 41 | ||||
-rw-r--r-- | doc/mathop.n | 4 | ||||
-rw-r--r-- | doc/regexp.n | 10 | ||||
-rw-r--r-- | doc/split.n | 10 |
10 files changed, 91 insertions, 70 deletions
diff --git a/doc/apply.n b/doc/apply.n index bcdf6bd..8a38aac 100644 --- a/doc/apply.n +++ b/doc/apply.n @@ -74,9 +74,9 @@ proc map {lambda list} { return $result } map {x {return [string length $x]:$x}} {a bb ccc dddd} - \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} - \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 @@ -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: join.n,v 1.7 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: join.n,v 1.8 2007/11/01 23:36:46 dkf Exp $ '\" .so man.macros .TH join n "" Tcl "Tcl Built-In Commands" @@ -29,14 +29,14 @@ Making a comma-separated list: .CS set data {1 2 3 4 5} \fBjoin\fR $data ", " - \fB=> 1, 2, 3, 4, 5\fR + \fB\(-> 1, 2, 3, 4, 5\fR .CE .PP Using \fBjoin\fR to flatten a list by a single level: .CS set data {1 {2 3} 4 {5 {6 7} 8}} \fBjoin\fR $data - \fB=> 1 2 3 4 5 {6 7} 8\fR + \fB\(-> 1 2 3 4 5 {6 7} 8\fR .CE .SH "SEE ALSO" diff --git a/doc/lindex.n b/doc/lindex.n index e459a2b..90cb3c2 100644 --- a/doc/lindex.n +++ b/doc/lindex.n @@ -6,7 +6,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: lindex.n,v 1.14 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: lindex.n,v 1.15 2007/11/01 23:36:46 dkf Exp $ '\" .so man.macros .TH lindex n 8.4 Tcl "Tcl Built-In Commands" @@ -68,16 +68,26 @@ lindex [lindex [lindex $a 1] 2] 3 .CE .SH EXAMPLES .CS -\fBlindex\fR {a b c} \fI=> a b c\fR -\fBlindex\fR {a b c} {} \fI=> a b c\fR -\fBlindex\fR {a b c} 0 \fI=> a\fR -\fBlindex\fR {a b c} 2 \fI=> c\fR -\fBlindex\fR {a b c} end \fI=> c\fR -\fBlindex\fR {a b c} end-1 \fI=> b\fR -\fBlindex\fR {{a b c} {d e f} {g h i}} 2 1 \fI=> h\fR -\fBlindex\fR {{a b c} {d e f} {g h i}} {2 1} \fI=> h\fR -\fBlindex\fR {{{a b} {c d}} {{e f} {g h}}} 1 1 0 \fI=> g\fR -\fBlindex\fR {{{a b} {c d}} {{e f} {g h}}} {1 1 0} \fI=> g\fR +\fBlindex\fR {a b c} + \fI\(-> a b c\fR +\fBlindex\fR {a b c} {} + \fI\(-> a b c\fR +\fBlindex\fR {a b c} 0 + \fI\(-> a\fR +\fBlindex\fR {a b c} 2 + \fI\(-> c\fR +\fBlindex\fR {a b c} end + \fI\(-> c\fR +\fBlindex\fR {a b c} end-1 + \fI\(-> b\fR +\fBlindex\fR {{a b c} {d e f} {g h i}} 2 1 + \fI\(-> h\fR +\fBlindex\fR {{a b c} {d e f} {g h i}} {2 1} + \fI\(-> h\fR +\fBlindex\fR {{{a b} {c d}} {{e f} {g h}}} 1 1 0 + \fI\(-> g\fR +\fBlindex\fR {{{a b} {c d}} {{e f} {g h}}} {1 1 0} + \fI\(-> g\fR .CE .SH "SEE ALSO" list(n), lappend(n), linsert(n), llength(n), lsearch(n), diff --git a/doc/lrepeat.n b/doc/lrepeat.n index fdd1388..f47c7a3 100644 --- a/doc/lrepeat.n +++ b/doc/lrepeat.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: lrepeat.n,v 1.4 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: lrepeat.n,v 1.5 2007/11/01 23:36:46 dkf Exp $ '\" .so man.macros .TH lrepeat n 8.5 Tcl "Tcl Built-In Commands" @@ -25,10 +25,14 @@ is identical to \fBlist arg ...\fR, though the \fIarg\fR is required with \fBlrepeat\fR. .SH EXAMPLES .CS -lrepeat 3 a => a a a -lrepeat 3 [lrepeat 3 0] => {0 0 0} {0 0 0} {0 0 0} -lrepeat 3 a b c => a b c a b c a b c -lrepeat 3 [lrepeat 2 a] b c => {a a} b c {a a} b c {a a} b c +\fBlrepeat\fR 3 a + \fI\(-> a a a\fR +\fBlrepeat\fR 3 [\fBlrepeat\fR 3 0] + \fI\(-> {0 0 0} {0 0 0} {0 0 0}\fR +\fBlrepeat\fR 3 a b c + \fI\(-> a b c a b c a b c\fR +\fBlrepeat\fR 3 [\fBlrepeat\fR 2 a] b c + \fI\(-> {a a} b c {a a} b c {a a} b c\fR .CE .SH "SEE ALSO" list(n), lappend(n), linsert(n), llength(n), lset(n) diff --git a/doc/lreverse.n b/doc/lreverse.n index b1cd594..2f56fd2 100644 --- a/doc/lreverse.n +++ b/doc/lreverse.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: lreverse.n,v 1.4 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: lreverse.n,v 1.5 2007/11/01 23:36:46 dkf Exp $ '\" .so man.macros .TH lreverse n 8.5 Tcl "Tcl Built-In Commands" @@ -21,8 +21,10 @@ The \fBlreverse\fR command returns a list that has the same elements as its input list, \fIlist\fR, except with the elements in the reverse order. .SH EXAMPLES .CS -\fBlreverse\fR {a a b c} => c b a a -\fBlreverse\fR {a b {c d} e f} => f e {c d} b a +\fBlreverse\fR {a a b c} + \fI\(-> c b a a\fR +\fBlreverse\fR {a b {c d} e f} + \fI\(-> f e {c d} b a\fR .CE .SH "SEE ALSO" list(n), lsearch(n), lsort(n) diff --git a/doc/lsearch.n b/doc/lsearch.n index 897a207..2972a32 100644 --- a/doc/lsearch.n +++ b/doc/lsearch.n @@ -7,7 +7,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.31 2007/10/29 11:28:50 dkf Exp $ +'\" RCS: @(#) $Id: lsearch.n,v 1.32 2007/11/01 23:36:46 dkf Exp $ '\" .so man.macros .TH lsearch n 8.5 Tcl "Tcl Built-In Commands" @@ -18,7 +18,6 @@ lsearch \- See if a list contains a particular element .SH SYNOPSIS \fBlsearch \fR?\fIoptions\fR? \fIlist pattern\fR .BE - .SH DESCRIPTION .PP This command searches the elements of \fIlist\fR to see if one @@ -143,53 +142,50 @@ overall list to the term found. This option has no effect unless the Basic searching: .CS \fBlsearch\fR {a b c d e} c - => 2 + \fI\(-> 2\fR \fBlsearch\fR -all {a b c a b c} c - => 2 5 + \fI\(-> 2 5\fR .CE - +.PP Using \fBlsearch\fR to filter lists: .CS \fBlsearch\fR -inline {a20 b35 c47} b* - => b35 + \fI\(-> b35\fR \fBlsearch\fR -inline -not {a20 b35 c47} b* - => a20 + \fI\(-> a20\fR \fBlsearch\fR -all -inline -not {a20 b35 c47} b* - => a20 c47 + \fI\(-> a20 c47\fR \fBlsearch\fR -all -not {a20 b35 c47} b* - => 0 2 + \fI\(-> 0 2\fR .CE +.PP This can even do a .QW set-like removal operation: .CS \fBlsearch\fR -all -inline -not -exact {a b c a d e a f g a} a - => b c d e f g + \fI\(-> b c d e f g\fR .CE - +.PP Searching may start part-way through the list: .CS \fBlsearch\fR -start 3 {a b c a b c} c - => 5 + \fI\(-> 5\fR .CE - +.PP It is also possible to search inside elements: .CS \fBlsearch\fR -index 1 -all -inline {{a abc} {b bcd} {c cde}} *bc* - => {a abc} {b bcd} + \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), .VS 8.5 string(n) .VE - - .SH KEYWORDS list, match, pattern, regular expression, search, string - '\" Local Variables: '\" mode: nroff '\" End: @@ -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.12 2007/10/26 20:11:53 dgp Exp $ +'\" RCS: @(#) $Id: lset.n,v 1.13 2007/11/01 23:36:46 dkf Exp $ '\" .so man.macros .TH lset n 8.4 Tcl "Tcl Built-In Commands" @@ -80,32 +80,43 @@ of a list. If an index is outside the permitted range, an error is reported. In each of these examples, the initial value of \fIx\fR is: .CS set x [list [list a b c] [list d e f] [list g h i]] - => {a b c} {d e f} {g h i} + \fI\(-> {a b c} {d e f} {g h i}\fR .CE The indicated return value also becomes the new value of \fIx\fR (except in the last case, which is an error which leaves the value of \fIx\fR unchanged.) .CS -lset x {j k l} => j k l -lset x {} {j k l} => j k l -lset x 0 j => j {d e f} {g h i} -lset x 2 j => {a b c} {d e f} j -lset x end j => {a b c} {d e f} j -lset x end-1 j => {a b c} j {g h i} -lset x 2 1 j => {a b c} {d e f} {g j i} -lset x {2 1} j => {a b c} {d e f} {g j i} -lset x {2 3} j => \fIlist index out of range\fR +\fBlset\fR x {j k l} + \fI\(-> j k l\fR +\fBlset\fR x {} {j k l} + \fI\(-> j k l\fR +\fBlset\fR x 0 j + \fI\(-> j {d e f} {g h i}\fR +\fBlset\fR x 2 j + \fI\(-> {a b c} {d e f} j\fR +\fBlset\fR x end j + \fI\(-> {a b c} {d e f} j\fR +\fBlset\fR x end-1 j + \fI\(-> {a b c} j {g h i}\fR +\fBlset\fR x 2 1 j + \fI\(-> {a b c} {d e f} {g j i}\fR +\fBlset\fR x {2 1} j + \fI\(-> {a b c} {d e f} {g j i}\fR +\fBlset\fR x {2 3} j + \fI\(-> list index out of range\fR .CE In the following examples, the initial value of \fIx\fR is: .CS set x [list [list [list a b] [list c d]] \e [list [list e f] [list g h]]] - => {{a b} {c d}} {{e f} {g h}} + \fI\(-> {{a b} {c d}} {{e f} {g h}}\fR .CE The indicated return value also becomes the new value of \fIx\fR. .CS -lset x 1 1 0 j => {{a b} {c d}} {{e f} {j h}} -lset x {1 1 0} j => {{a b} {c d}} {{e f} {j h}} +\fBlset\fR x 1 1 0 j + \fI\(-> {{a b} {c d}} {{e f} {j h}}\fR +\fBlset\fR x {1 1 0} j + \fI\(-> {{a b} {c d}} {{e f} {j h}}\fR .CE .SH "SEE ALSO" list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n), @@ -113,7 +124,5 @@ lsort(n), lrange(n), lreplace(n), .VS 8.5 string(n) .VE - - .SH KEYWORDS element, index, list, replace, set diff --git a/doc/mathop.n b/doc/mathop.n index 6d55e02..f6d50f8 100644 --- a/doc/mathop.n +++ b/doc/mathop.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: mathop.n,v 1.6 2007/10/26 20:11:53 dgp Exp $ +.\" RCS: @(#) $Id: mathop.n,v 1.7 2007/11/01 23:36:46 dkf Exp $ .\" .so man.macros .TH mathop n 8.5 Tcl "Tcl Mathematical Operator Commands" @@ -49,7 +49,7 @@ package require \fBTcl 8.5\fR .br \fB::tcl::mathop::<=\fR ?\fIarg\fR ...? .br -\fB::tcl::mathop::=>\fR ?\fIarg\fR ...? +\fB::tcl::mathop::>=\fR ?\fIarg\fR ...? .br \fB::tcl::mathop::>\fR ?\fIarg\fR ...? .br diff --git a/doc/regexp.n b/doc/regexp.n index 5523ce6..d5994d5 100644 --- a/doc/regexp.n +++ b/doc/regexp.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: regexp.n,v 1.26 2007/10/29 11:28:50 dkf Exp $ +'\" RCS: @(#) $Id: regexp.n,v 1.27 2007/11/01 23:36:46 dkf Exp $ '\" .so man.macros .TH regexp n 8.3 Tcl "Tcl Built-In Commands" @@ -116,10 +116,10 @@ always returned. For each match iteration, the command will append the overall match data, plus one element for each subexpression in the regular expression. Examples are: .CS - regexp -inline -- {\ew(\ew)} " inlined " - => {in n} - regexp -all -inline -- {\ew(\ew)} " inlined " - => {in n li i ne e} +\fBregexp\fR -inline -- {\ew(\ew)} " inlined " + \fI\(-> in n\fR +\fBregexp\fR -all -inline -- {\ew(\ew)} " inlined " + \fI\(-> in n li i ne e\fR .CE .TP 15 \fB\-start\fR \fIindex\fR diff --git a/doc/split.n b/doc/split.n index d3970d1..c13a94e 100644 --- a/doc/split.n +++ b/doc/split.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: split.n,v 1.8 2007/10/28 14:17:40 dkf Exp $ +'\" RCS: @(#) $Id: split.n,v 1.9 2007/11/01 23:36:46 dkf Exp $ '\" .so man.macros .TH split n "" Tcl "Tcl Built-In Commands" @@ -34,7 +34,7 @@ If \fIsplitChars\fR is an empty string then each character of Divide up a USENET group name into its hierarchical components: .CS \fBsplit\fR "comp.lang.tcl.announce" . - \fI=> comp lang tcl announce\fR + \fI\(-> comp lang tcl announce\fR .CE .PP See how the \fBsplit\fR command splits on \fIevery\fR character in @@ -42,19 +42,19 @@ See how the \fBsplit\fR command splits on \fIevery\fR character in careful: .CS \fBsplit\fR "alpha beta gamma" "temp" - \fI=> al {ha b} {} {a ga} {} a\fR + \fI\(-> al {ha b} {} {a ga} {} a\fR .CE .PP Extract the list words from a string that is not a well-formed list: .CS \fBsplit\fR "Example with {unbalanced brace character" - \fI=> Example with \e{unbalanced brace character\fR + \fI\(-> Example with \e{unbalanced brace character\fR .CE .PP Split a string into its constituent characters .CS \fBsplit\fR "Hello world" {} - \fI=> H e l l o { } w o r l d\fR + \fI\(-> H e l l o { } w o r l d\fR .CE .SS "PARSING RECORD-ORIENTED FILES" Parse a Unix /etc/passwd file, which consists of one entry per line, |