1lrepeat(n) Tcl Built-In Commands lrepeat(n)
2
3
4
5______________________________________________________________________________
6
8 lrepeat - Build a list by repeating elements
9
11 lrepeat number element1 ?element2 element3 ...?
12_________________________________________________________________
13
15 The lrepeat command creates a list of size number * number of elements
16 by repeating number times the sequence of elements element1 element2
17 .... number must be a positive integer, elementn can be any Tcl value.
18 Note that lrepeat 1 arg ... is identical to list arg ..., though the
19 arg is required with lrepeat.
20
22 lrepeat 3 a
23 → a a a
24 lrepeat 3 [lrepeat 3 0]
25 → {0 0 0} {0 0 0} {0 0 0}
26 lrepeat 3 a b c
27 → a b c a b c a b c
28 lrepeat 3 [lrepeat 2 a] b c
29 → {a a} b c {a a} b c {a a} b c
30
32 list(n), lappend(n), linsert(n), llength(n), lset(n)
33
34
36 element, index, list
37
38
39
40Tcl 8.5 lrepeat(n)