concat(n)
π concat(n) π
ok so bestie, welcome to concat β it's a built-in command from the Tcl Built-In Commands manual, and it's literally the glue stick of Tcl. β¨
πΈ NAME πΈ
concat β join lists together π«Ά
β¨ SYNOPSIS β¨
concat ?arg arg ...?
π DESCRIPTION π
okay so here's the vibe: this command takes each of its arguments and joins them all together with spaces, but first it trims the leading and trailing white-space off of every single one of them. π§Ήβ¨
and like β if all of the arguments are lists, then this has the exact same effect as concatenating them into one single list. no cap. π
arguments that end up empty (like, after the trimming happens) are just ignored entirely. they don't get a seat at the table, they're not invited, bye. π
it permits any number of arguments, bestie β zero, one, a hundred, whatever. and if you supply no args at all, the result is just an empty string. that's it. that's the whole thing. π
π₯ EXAMPLES π₯
so even though concat will concatenate lists and flatten them in the process, like in this little interactive session right here:
% concat a b {c d e} {f {g h}}
a b c d e f {g h}
...it will also concatenate stuff that isn't even a list, which you can see from this next session:
% concat " a b {c " d " e} f"
a b {c d e} f
and note β note this, fr fr β the concatenation does not remove spaces from the middle of values. look:
% concat "a b c" { d e f }
a b c d e f
(i.e., there are three spaces between each of the a, the b and the c. yes really. count them. π«£)
so if you want true list concatenation, you should use the list command with expansion of each input list:
% list {*}"a b c" {*}{ d e f }
a b c d e f
see?? that one actually collapsed the spaces. main character behavior. π
π SEE ALSO π
β KEYWORDS β
concatenate, join, list
ok that's the whole page bestie!! this one's from the <strong>Tcl 8.3</strong> era, dated way back, and it's filed under the <strong>concat(n)</strong> page in the Tcl manual set. go forth and glue your lists together πβ¨ππ¦
π¦ 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) 1993 The Regents of the University of California
- Copyright (c) 1994-1996 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms