Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/doc/linsert.n @ 42

Last change on this file since 42 was 25, checked in by landauf, 17 years ago

added tcl to libs

File size: 1.7 KB
Line 
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: linsert.n,v 1.14 2008/03/26 09:59:22 dkf Exp $
10'\"
11.so man.macros
12.TH linsert n 8.2 Tcl "Tcl Built-In Commands"
13.BS
14'\" Note:  do not modify the .SH NAME line immediately below!
15.SH NAME
16linsert \- Insert elements into a list
17.SH SYNOPSIS
18\fBlinsert \fIlist index element \fR?\fIelement element ...\fR?
19.BE
20
21.SH DESCRIPTION
22.PP
23This command produces a new list from \fIlist\fR by inserting all of the
24\fIelement\fR arguments just before the \fIindex\fR'th element of
25\fIlist\fR.  Each \fIelement\fR argument will become a separate element of
26the new list.  If \fIindex\fR is less than or equal to zero, then the new
27elements are inserted at the beginning of the list. 
28.VS 8.5
29The interpretation of the \fIindex\fR value is the same as
30for the command \fBstring index\fR, supporting simple index
31arithmetic and indices relative to the end of the list.
32.VE
33.SH EXAMPLE
34Putting some values into a list, first indexing from the start and
35then indexing from the end, and then chaining them together:
36.CS
37set oldList {the fox jumps over the dog}
38set midList [\fBlinsert\fR $oldList 1 quick]
39set newList [\fBlinsert\fR $midList end-1 lazy]
40# The old lists still exist though...
41set newerList [\fBlinsert\fR [\fBlinsert\fR $oldList end-1 quick] 1 lazy]
42.CE
43
44.SH "SEE ALSO"
45list(n), lappend(n), lindex(n), llength(n), lsearch(n),
46lset(n), lsort(n), lrange(n), lreplace(n),
47.VS 8.5
48string(n)
49.VE
50
51.SH KEYWORDS
52element, insert, list
Note: See TracBrowser for help on using the repository browser.