lrepeat(n)
β¨ lrepeat(n) β¨
okay bestie, welcome to the lrepeat page, from the Tcl Built-In Commands collection π this one's a lil cutie and you're gonna be obsessed.
π NAME π
lrepeat β build a list by repeating elements π¦
πΈ SYNOPSIS πΈ
lrepeat count ?element ...?
π DESCRIPTION π
so here's the tea: lrepeat makes a list whose size is count multiplied by the number of elements, by repeating the sequence of elements element ... exactly count times. slay β¨
counthas to be a non-negative integer, no cap π«Άelementcan be literally any Tcl value, anything, go feral
also lowkey important: lrepeat 1 element ... is identical to list element ... π like it's the same thing bestie, they're twins.
π₯ EXAMPLES π₯
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
look at that. the way that nested one just works? main character energy fr fr π
π SEE ALSO π
the whole friend group, go say hi:
list(n)lappend(n)lassign(n)ledit(n)lindex(n)linsert(n)llength(n)lmap(n)lpop(n)lrange(n)lremove(n)lreplace(n)lreverse(n)lsearch(n)lseq(n)lset(n)lsort(n)
β KEYWORDS β
element, index, list
okay that's the whole page, you ate it up π
this came to you from Tcl 8.5, and it's the lrepeat(n) page β go build some lists bestie, ily ππ¦π
π¦ where this page comes from
- alpine 3.23: tcl9-doc 9.0.3-r0 Β· TCL
- alpine 3.24: tcl9-doc 9.0.3-r2 Β· TCL
- fedora 43: tcl-doc 1:9.0.2-1.fc43 Β· TCL AND GPL-3.0-or-later WITH Bison-exception-2.2 AND BSD-3-Clause
- fedora 44: tcl-doc 1:9.0.2-1.fc44 Β· TCL AND GPL-3.0-or-later WITH Bison-exception-2.2 AND BSD-3-Clause
- nixos 26.05: tcl 9.0.3
- nixpkgs unstable: tcl 9.1.0
- 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