lrepeat(n)

πŸ“¦
version 9.0.3 Β· 3 versions
, in alpine 3.23, alpine 3.24, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

✨ 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 ✨

  • count has to be a non-negative integer, no cap 🫢
  • element can 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:


⭐ 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