Error processing request
Parameters
CONTENT_LENGTH | 0 |
REQUEST_METHOD | GET |
REQUEST_URI | /revision/lindex?V=25 |
QUERY_STRING | V=25 |
CONTENT_TYPE | |
DOCUMENT_URI | /revision/lindex |
DOCUMENT_ROOT | /var/www/nikit/nikit/nginx/../docroot |
SCGI | 1 |
SERVER_PROTOCOL | HTTP/1.1 |
HTTPS | on |
REMOTE_ADDR | 172.70.130.133 |
REMOTE_PORT | 36964 |
SERVER_PORT | 4443 |
SERVER_NAME | wiki.tcl-lang.org |
HTTP_HOST | wiki.tcl-lang.org |
HTTP_CONNECTION | Keep-Alive |
HTTP_ACCEPT_ENCODING | gzip, br |
HTTP_X_FORWARDED_FOR | 18.223.21.5 |
HTTP_CF_RAY | 87f2757ca9e92bed-ORD |
HTTP_X_FORWARDED_PROTO | https |
HTTP_CF_VISITOR | {"scheme":"https"} |
HTTP_ACCEPT | */* |
HTTP_USER_AGENT | Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected]) |
HTTP_CF_CONNECTING_IP | 18.223.21.5 |
HTTP_CDN_LOOP | cloudflare |
HTTP_CF_IPCOUNTRY | US |
Body
Error
Unknow state transition: LINE -> END
-code
1
-level
0
-errorstack
INNER {returnImm {Unknow state transition: LINE -> END} {}} CALL {my render_wikit lindex {'''[http://www.tcl.tk/man/tcl/TclCmd/lindex.htm%|%lindex]''', a [Tcl Commands%|%built-in] Tcl command, retrieves an [element] from a `[list]` or a nested
Commands%|%built-in] Tcl command, retrieves an item from a [list] or a nested
** See Also **
[list]:
[Trees as nested lists]:
[lappend]:
[linsert]:
[llength]:
[lrange]:
[lreplace]:
[lsearch]:
[lsort]:
[lindex forward compatibility]:
[identity function]: one use for `lindex`
[http://www.tcl.tk/man/tcl/TclCmd/lindex.htm%|%official reference]:
[TIP] [http://www.tcl.tk/cgi-bin/tct/tip/22.html%|%22]: Multiple Arguments to `lindex`:
[TIP] [http://www.tcl.tk/cgi-bin/tct/tip/22.html%|%22]: Multiple Arguments to [[`lindex`]:
[TIP] [http://www.tcl.tk/cgi-bin/tct/tip/45.html%|%45]: Empty index lists for `lindex` and `[lset]`:
[TIP] [http://www.tcl.tk/cgi-bin/tct/tip/45.html%|%45]: Empty index lists for [[`lindex`] and [[`[lset]`]:
** Synopsis **
: '''lindex''' ''list'' ?''index ...''?
: '''lindex''' ''list index'' ?''index ...''?
** Description **
Returns the ''index'''th element from ''list'', where the first element in
Returns the ''index'''th [element] from ''list'', where the first element in
the number of elements in list, an empty string is returned. If there is no ''index'' argument, ''list'' is returned even if it is not a well-formed list.
the number of elements in list, an empty string is returned.
''index'' can be any of the forms described for `[string]` indices.
''index'' can be any of the forms described for [[`[string]`] indices.
Where multiple ''index'' arguments are given, they specify a path to an element
Where multiple ''index'' arguments are given, they specify a path to an element
======
lindex {{a b c} {d e f} {g h i}} 1 1 ;# -> e
lindex {{a b c} {d e f} {g h i}} 1 1] ;# -> e
If one ''index''' is given, and it is a list of indexes, those indexes also
specify a path to a element in a nested list. Thus, these three are equivalent:
specify a path to an item in a nested list. Thus, these three are equivalent:
======
lindex $nestedList 1 2 3
lindex $nestedList {1 2 3}
lindex [lindex [lindex $nestedList 1] 2] 3
======
Without any indices, or with an empty ''indexList'', the contents of the
''list'' argument are returned without further interpretation, meaning that in
this case, ''list'' isn't even checked to make sure it is a properly formatted
list. Therefore, any value at all is valid. This can be useful when a
function that simply returns its argument is needed.
** History **
** Discussion **
[[`lrange`] appeared in Tcl 8.5.
** Disussion **
[LES] 2005-08-15: What does `lindex` do that `[lrange]` doesn't?
[LES] 2005-08-15: What does [[`lindex`] do that [[`[lrange]`] doesn't?
[pmaage] take less time [schlenk] direct access to elements in nested lists.
[LES] Look, Ma! No lindex!
======
proc picknested {argList args} {
for {set _depth 0} {$_depth < [llength $args]} {incr _depth} {
set _range [lrange $args $_depth $_depth]
set argList {*}[lrange $argList $_range $_range]
}
return $argList
}
======
Testing:
======none
% picknested {{a b c} {d e {foo bar hey} f} {g h i}} 0
a b c
% picknested {{a b c} {d e {foo bar hey} f} {g h i}} 0 1
b
% picknested {{a b c} {d e {foo bar hey} f} {g h i}} 1 2
foo bar hey
% picknested {{a b c} {d e {foo bar hey} f} {g h i}} 1 2 0
foo
% picknested {{a b c} {d e {foo bar hey} f} {g h i}} 1 2 2
hey
======
[schlenk]: Should have said 'easy' access. You can do the same with
`[lrange]`, yes. You do not need all list commands, most can be replaced by
[[`[lrange]`], yes. You do not need all list commands, most can be replaced by
how many list commands exist. (see [struct::list] for some more). Having more
or fewer commands is mostly an optimization in time or space.
[Lars H]: I'd go further and say `[lrange]` still doesn't give you access to
[Lars H]: I'd go further and say [[`[lrange]`] still doesn't give you access to
the nested elements--it's really [{*}] (and in the case of the indices
shimmering) that you rely on to pick out elements of lists (undo whatever
much simpler with `[foreach]`?
much simpler with [[`[foreach]`]?
======
proc picknested2 {L args} {
foreach index $args {
if {$index < 0} then {return {}}
foreach L $L {
if {[incr index -1] < 0} then {break}
if {[incr index -1]<0} then {break}
}
}
return $L
}
======
Remove the first and last `[if]` if you don't worry about correct behaviour
Remove the first and last [[`[if]`] if you don't worry about correct behaviour
[AMG], perhaps echoing [Lars H]: `[lrange]` can't directly be used to obtain a single element from a list. The closest it comes is to return a ''list'' whose sole element is the one you're looking for. The difference is the same as that between a value and a single-element list containing that value. For many values, there is no script-visible difference (unless you're measuring performance, see [shimmering]). But you cannot rely on this in general. Here's an example:} regexp2} CALL {my render lindex {'''[http://www.tcl.tk/man/tcl/TclCmd/lindex.htm%|%lindex]''', a [Tcl Commands%|%built-in] Tcl command, retrieves an [element] from a `[list]` or a nested
Commands%|%built-in] Tcl command, retrieves an item from a [list] or a nested
** See Also **
[list]:
[Trees as nested lists]:
[lappend]:
[linsert]:
[llength]:
[lrange]:
[lreplace]:
[lsearch]:
[lsort]:
[lindex forward compatibility]:
[identity function]: one use for `lindex`
[http://www.tcl.tk/man/tcl/TclCmd/lindex.htm%|%official reference]:
[TIP] [http://www.tcl.tk/cgi-bin/tct/tip/22.html%|%22]: Multiple Arguments to `lindex`:
[TIP] [http://www.tcl.tk/cgi-bin/tct/tip/22.html%|%22]: Multiple Arguments to [[`lindex`]:
[TIP] [http://www.tcl.tk/cgi-bin/tct/tip/45.html%|%45]: Empty index lists for `lindex` and `[lset]`:
[TIP] [http://www.tcl.tk/cgi-bin/tct/tip/45.html%|%45]: Empty index lists for [[`lindex`] and [[`[lset]`]:
** Synopsis **
: '''lindex''' ''list'' ?''index ...''?
: '''lindex''' ''list index'' ?''index ...''?
** Description **
Returns the ''index'''th element from ''list'', where the first element in
Returns the ''index'''th [element] from ''list'', where the first element in
the number of elements in list, an empty string is returned. If there is no ''index'' argument, ''list'' is returned even if it is not a well-formed list.
the number of elements in list, an empty string is returned.
''index'' can be any of the forms described for `[string]` indices.
''index'' can be any of the forms described for [[`[string]`] indices.
Where multiple ''index'' arguments are given, they specify a path to an element
Where multiple ''index'' arguments are given, they specify a path to an element
======
lindex {{a b c} {d e f} {g h i}} 1 1 ;# -> e
lindex {{a b c} {d e f} {g h i}} 1 1] ;# -> e
If one ''index''' is given, and it is a list of indexes, those indexes also
specify a path to a element in a nested list. Thus, these three are equivalent:
specify a path to an item in a nested list. Thus, these three are equivalent:
======
lindex $nestedList 1 2 3
lindex $nestedList {1 2 3}
lindex [lindex [lindex $nestedList 1] 2] 3
======
Without any indices, or with an empty ''indexList'', the contents of the
''list'' argument are returned without further interpretation, meaning that in
this case, ''list'' isn't even checked to make sure it is a properly formatted
list. Therefore, any value at all is valid. This can be useful when a
function that simply returns its argument is needed.
** History **
** Discussion **
[[`lrange`] appeared in Tcl 8.5.
** Disussion **
[LES] 2005-08-15: What does `lindex` do that `[lrange]` doesn't?
[LES] 2005-08-15: What does [[`lindex`] do that [[`[lrange]`] doesn't?
[pmaage] take less time [schlenk] direct access to elements in nested lists.
[LES] Look, Ma! No lindex!
======
proc picknested {argList args} {
for {set _depth 0} {$_depth < [llength $args]} {incr _depth} {
set _range [lrange $args $_depth $_depth]
set argList {*}[lrange $argList $_range $_range]
}
return $argList
}
======
Testing:
======none
% picknested {{a b c} {d e {foo bar hey} f} {g h i}} 0
a b c
% picknested {{a b c} {d e {foo bar hey} f} {g h i}} 0 1
b
% picknested {{a b c} {d e {foo bar hey} f} {g h i}} 1 2
foo bar hey
% picknested {{a b c} {d e {foo bar hey} f} {g h i}} 1 2 0
foo
% picknested {{a b c} {d e {foo bar hey} f} {g h i}} 1 2 2
hey
======
[schlenk]: Should have said 'easy' access. You can do the same with
`[lrange]`, yes. You do not need all list commands, most can be replaced by
[[`[lrange]`], yes. You do not need all list commands, most can be replaced by
how many list commands exist. (see [struct::list] for some more). Having more
or fewer commands is mostly an optimization in time or space.
[Lars H]: I'd go further and say `[lrange]` still doesn't give you access to
[Lars H]: I'd go further and say [[`[lrange]`] still doesn't give you access to
the nested elements--it's really [{*}] (and in the case of the indices
shimmering) that you rely on to pick out elements of lists (undo whatever
much simpler with `[foreach]`?
much simpler with [[`[foreach]`]?
======
proc picknested2 {L args} {
foreach index $args {
if {$index < 0} then {return {}}
foreach L $L {
if {[incr index -1] < 0} then {break}
if {[incr index -1]<0} then {break}
}
}
return $L
}
======
Remove the first and last `[if]` if you don't worry about correct behaviour
Remove the first and last [[`[if]`] if you don't worry about correct behaviour
[AMG], perhaps echoing [Lars H]: `[lrange]` can't directly be used to obtain a single element from a list. The closest it comes is to return a ''list'' whose sole element is the one you're looking for. The difference is the same as that between a value and a single-element list containing that value. For many values, there is no script-visible difference (unless you're measuring performance, see [shimmering]). But you cannot rely on this in general. Here's an example:}} CALL {my revision lindex} CALL {::oo::Obj6312317 process revision/lindex} CALL {::oo::Obj6312315 process}
-errorcode
NONE
-errorinfo
Unknow state transition: LINE -> END
while executing
"error $msg"
(class "::Wiki" method "render_wikit" line 6)
invoked from within
"my render_$default_markup $N $C $mkup_rendering_engine"
(class "::Wiki" method "render" line 8)
invoked from within
"my render $name $C"
(class "::Wiki" method "revision" line 31)
invoked from within
"my revision $page"
(class "::Wiki" method "process" line 56)
invoked from within
"$server process [string trim $uri /]"
-errorline
4