lrepeat(3tcl)

πŸ“¦
version 9.0.4 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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:

  • count must be a non-negative integer. like, zero and up, bestie. don't try anything weird.
  • element can be any Tcl value. anything. go feral. 🌈
πŸ’€ also worth clocking: lrepeat 1 element ... is identical to list 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:


⭐ 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