.
.
名称
lrepeat - 使用重复的元素构造一个列表
语法
lrepeat number element1 ?element2 element3 ...?
描述
lrepeat命令创建一个列表,列表是一个重复element中所有的元素number次而生成的新列表,number必须是一个整数,elementn可以使任意Tcl值。注意lrepeat 1 arg与list arg相同。
示例
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