llength(3tcl)
๐ llength โ the Tcl Built-In Commands glow-up ๐
okay bestie, gather round, because today we're talking about llength from the Tcl Built-In Commands crew, and honestly? she's a whole vibe. โจ
โจ NAME โจ
llength โ count the number of elements in a list ๐งฎ๐
๐ธ SYNOPSIS ๐ธ
llength list
๐ฆ DESCRIPTION ๐ฆ
So here's the tea: you hand her a list, she treats it like a list (obviously, she's not gonna argue with you about it), and she hands you back a decimal string โ that's the number of elements chilling inside it. That's it. That's the whole job. And she does it flawlessly, no cap. ๐
๐ EXAMPLES ๐
first up, the basics: the result is literally just the number of elements. iconic behaviour.
% llength {a b c d e}
5
% llength {a b c}
3
% llength {}
0
now listen, elements are not guaranteed to be exactly words in the dictionary sense of things โ obviously, especially once quoting enters the chat. it's giving "a word is whatever the list parser says it is" ๐
% llength {a b {c d} e}
4
% llength {a b { } c d e}
6
and here's the plot twist that gets people every single time: an empty list is not necessarily an empty string. those two are NOT the same bestie, don't let anyone tell you otherwise ๐ญ
% set var { }; puts "[string length $var],[llength $var]"
1,0
look at that. string length says 1, llength says 0. two different numbers, two different questions. she contains multitudes. ๐โจ
๐ SEE ALSO ๐
the whole friend group, because they run deep and they run together ๐ซถ
list(3tcl)lappend(3tcl)lassign(3tcl)ledit(3tcl)lindex(3tcl)linsert(3tcl)lmap(3tcl)lpop(3tcl)lrange(3tcl)lremove(3tcl)lrepeat(3tcl)lreplace(3tcl)lreverse(3tcl)lsearch(3tcl)lseq(3tcl)lset(3tcl)lsort(3tcl)
๐ KEYWORDS ๐
element, list, length โ the trio. the holy trinity. the main character energy. โญ
and that's the whole page, bestie!! ๐ this one comes to you straight from Tcl, filed under llength(3tcl), and she's been serving reliable list-counting realness since forever. go forth and count ur elements, you absolute legend ๐๐ธ๐ฆ๐
๐ฆ where this page comes from
- debian trixie: tcl9.0-doc 9.0.1+dfsg-2
- ubuntu questing: tcl9.0-doc 9.0.2+dfsg-1
- ubuntu resolute: tcl9.0-doc 9.0.3+dfsg-1
- ubuntu stonking: tcl9.0-doc 9.0.4+dfsg-1
- Copyright (c) 1993 The Regents of the University of California
- Copyright (c) 1994-1996 Sun Microsystems, Inc
- Copyright (c) 2001 Kevin B. Kenny <kennykb@acm.org>. All rights reserved
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms