summaryrefslogtreecommitdiffstats
path: root/doc/lrepeat.n
blob: 4b1ebce086576bd2f6f5039e298f587234dceed3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
'\"
'\" Copyright (c) 2003 by Simon Geard.  All rights reserved.
'\"
'\" 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.3 2007/10/25 09:25:27 dkf Exp $
'\" 
.so man.macros
.TH lrepeat n 8.5 Tcl "Tcl Built-In Commands"
.BS
'\" Note:  do not modify the .SH NAME line immediately below!
.SH NAME
lrepeat \- Build a list by repeating elements
.SH SYNOPSIS
\fBlrepeat \fInumber element1 \fR?\fIelement2 element3 ...\fR?
.BE
.SH DESCRIPTION
.PP
The \fBlrepeat\fR command creates a list of size \fInumber\fR \(mu \fInumber
of elements\fR by repeating \fInumber\fR times the sequence of elements
\fIelement1 element2 ...\fR. The \fInumber\fR must be a positive integer, and
each \fIelementN\fR can be any Tcl value.
.PP
Note that
.QW "\fBlrepeat 1 arg ...\fR"
is identical to
.QW "\fBlist arg ...\fR" ,
though the \fIarg\fR is required with \fBlrepeat\fR.
.SH EXAMPLES
.CS
.ta 3i
lrepeat 3 a	\fB\(->\fI a a a\fR
lrepeat 3 [lrepeat 3 0]	\fB\(->\fI {0 0 0} {0 0 0} {0 0 0}\fR
lrepeat 3 a b c	\fB\(->\fI a b c a b c a b c\fR
lrepeat 3 [lrepeat 2 a] b c	\fB\(->\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)

.SH KEYWORDS
element, index, list