lrepeat(3tcl)
π lrepeat β the Tcl built-in that said "again, again, again" π
okay bestie, welcome to lrepeat(3tcl), a member of the Tcl Built-In Commands fam. this one is a little icon and it does exactly one thing, but it does it flawlessly. β¨
πΈ NAME πΈ
lrepeat β build a list by repeating elements. that's it. that's the whole job. and she ATE. π
π SYNOPSIS π
lrepeat count ?element ...?
short. sweet. slays. π«Ά
π¦ DESCRIPTION π¦
so here's the tea, bestie: lrepeat creates a list whose size is count times the number of elements, by repeating the sequence of elements element ... exactly count times. no cap, it just keeps going like your fave song on loop. π
a couple things you gotta know before you run off:
countmust be a non-negative integer. like, zero and up, bestie. don't try anything weird.elementcan be any Tcl value. anything. go feral. π
π also worth clocking:lrepeat 1 element ...is identical tolist element .... same energy, same result, no notes. literally the same thing. iykyk.
β¨ EXAMPLES β¨
watch her work, she's so clean:
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
okay the last one is giving main character energy, nested lrepeats? obsessed. π§ the way that [lrepeat 2 a] gets braced into {a a} and then the whole lil group gets tripled? iconic. π
π SEE ALSO π
the whole group chat, go say hi:
list(3tcl)lappend(3tcl)lassign(3tcl)ledit(3tcl)lindex(3tcl)linsert(3tcl)llength(3tcl)lmap(3tcl)lpop(3tcl)lrange(3tcl)lremove(3tcl)lreplace(3tcl)lreverse(3tcl)lsearch(3tcl)lseq(3tcl)lset(3tcl)lsort(3tcl)
β KEYWORDS β
element, index, list
and that's the whole page bestie!! π brought to you by Tcl, version 8.5, and dated for lrepeat(3tcl) β mwah, go repeat some stuff, you've got this π«Άπβ¨
π¦ where this page comes from
- debian trixie: tcl9.0-doc 9.0.1+dfsg-2
- ubuntu questing: tcl9.0-doc 9.0.2+dfsg-1
- ubuntu resolute: tcl9.0-doc 9.0.3+dfsg-1
- ubuntu stonking: tcl9.0-doc 9.0.4+dfsg-1
- Copyright (c) 2003 Simon Geard. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms