1 | '\" |
---|
2 | '\" Copyright (c) 1993 The Regents of the University of California. |
---|
3 | '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. |
---|
4 | '\" Copyright (c) 2001 Kevin B. Kenny <kennykb@acm.org>. All rights reserved. |
---|
5 | '\" |
---|
6 | '\" See the file "license.terms" for information on usage and redistribution |
---|
7 | '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
8 | '\" |
---|
9 | '\" RCS: @(#) $Id: lappend.n,v 1.16 2008/03/26 09:59:22 dkf Exp $ |
---|
10 | '\" |
---|
11 | .so man.macros |
---|
12 | .TH lappend n "" Tcl "Tcl Built-In Commands" |
---|
13 | .BS |
---|
14 | '\" Note: do not modify the .SH NAME line immediately below! |
---|
15 | .SH NAME |
---|
16 | lappend \- Append list elements onto a variable |
---|
17 | .SH SYNOPSIS |
---|
18 | \fBlappend \fIvarName \fR?\fIvalue value value ...\fR? |
---|
19 | .BE |
---|
20 | |
---|
21 | .SH DESCRIPTION |
---|
22 | .PP |
---|
23 | This command treats the variable given by \fIvarName\fR as a list |
---|
24 | and appends each of the \fIvalue\fR arguments to that list as a separate |
---|
25 | element, with spaces between elements. |
---|
26 | If \fIvarName\fR does not exist, it is created as a list with elements |
---|
27 | given by the \fIvalue\fR arguments. |
---|
28 | \fBLappend\fR is similar to \fBappend\fR except that the \fIvalue\fRs |
---|
29 | are appended as list elements rather than raw text. |
---|
30 | This command provides a relatively efficient way to build up |
---|
31 | large lists. For example, |
---|
32 | .QW "\fBlappend a $b\fR" |
---|
33 | is much more efficient than |
---|
34 | .QW "\fBset a [concat $a [list $b]]\fR" |
---|
35 | when \fB$a\fR is long. |
---|
36 | .SH EXAMPLE |
---|
37 | Using \fBlappend\fR to build up a list of numbers. |
---|
38 | .CS |
---|
39 | % set var 1 |
---|
40 | 1 |
---|
41 | % \fBlappend\fR var 2 |
---|
42 | 1 2 |
---|
43 | % \fBlappend\fR var 3 4 5 |
---|
44 | 1 2 3 4 5 |
---|
45 | .CE |
---|
46 | |
---|
47 | .SH "SEE ALSO" |
---|
48 | list(n), lindex(n), linsert(n), llength(n), lset(n), |
---|
49 | lsort(n), lrange(n) |
---|
50 | |
---|
51 | .SH KEYWORDS |
---|
52 | append, element, list, variable |
---|