lreverse(n)
β¨ lreverse(n) β the Tcl glow-up where your list gets flipped π
ok so bestie, we're in the Tcl Built-In Commands section of the manual, and today's main character is lreverse(n). she does exactly one thing and she does it flawlessly. no cap. π¦
πΈ NAME πΈ
lreverse β reverse the order of a list π
β¨ SYNOPSIS β¨
lreverse list
π DESCRIPTION π
so here's the tea π: lreverse takes your list and hands you back a brand new list with all the same elements, justβ¦ backwards. same elements, same count, zero changes to what's inside β only the order gets flipped. it's giving mirror selfie. πΈ
π EXAMPLES π
watch her werk:
lreverse {a a b c}
β c b a a
lreverse {a b {c d} e f}
β f e {c d} b a
ok notice how {c d} stayed all wrapped up and cute as one element π₯Ί β she does not go digging inside your nested lists. outer order only. periodt. π
π SEE ALSO π
the whole squad, fr fr:
list(n)lappend(n)lassign(n)ledit(n)lindex(n)linsert(n)llength(n)lmap(n)lpop(n)lrange(n)lremove(n)lrepeat(n)lreplace(n)lsearch(n)lseq(n)lset(n)lsort(n)
π₯ KEYWORDS π₯
element, list, reverse
ok that's the whole page bestie, you ate that reading session π this one's brought to you by Tcl version 8.5, and yeah, the page itself is literally named lreverse(n) β iykyk. go flip something. πβ¨π«Ά
π¦ 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) 2006 Donal K. Fellows. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms