Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/lremove?V=19
QUERY_STRINGV=19
CONTENT_TYPE
DOCUMENT_URI/revision/lremove
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
HTTPSon
REMOTE_ADDR172.70.126.65
REMOTE_PORT14250
SERVER_PORT4443
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip, br
HTTP_X_FORWARDED_FOR3.149.214.32
HTTP_CF_RAY87d44715afcfe180-ORD
HTTP_X_FORWARDED_PROTOhttps
HTTP_CF_VISITOR{"scheme":"https"}
HTTP_ACCEPT*/*
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])
HTTP_CF_CONNECTING_IP3.149.214.32
HTTP_CDN_LOOPcloudflare
HTTP_CF_IPCOUNTRYUS

Body


Error

Unknow state transition: LINE -> END

-code

1

-level

0

-errorstack

INNER {returnImm {Unknow state transition: LINE -> END} {}} CALL {my render_wikit lremove How\ to\ remove\ items\ from\ a\ list\ not\ by\ their\ position\ (\[lreplace\])\ but\ by\ the\ actual\ content.\ \nMy\ solution\ would\ be:\n\n======\n\ proc\ K\ \{\ x\ y\ \}\ \{\ set\ x\ \}\n\ proc\ lremove\ \{\ listvar\ string\ \}\ \{\n\ \ \ \ \ \ \ \ \ upvar\ \$listvar\ in\n\ \ \ \ \ \ \ \ \ foreach\ item\ \[K\ \$in\ \[set\ in\ \[list\]\]\]\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ if\ \{\[string\ equal\ \$item\ \$string\]\}\ \{\ continue\ \}\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ lappend\ in\ \$item\n\ \ \ \ \ \ \ \ \ \}\n\ \}\n======\n\nwhich\ gives\ us\n\n\ %\ set\ a\ \[list\ a\ b\ c\ a\ b\ c\ a\ b\ c\]\n\ a\ b\ c\ a\ b\ c\ a\ b\ c\n\ %\ lremove\ a\ b\n\ %\ set\ a\n\ a\ c\ a\ c\ a\ c\n\nIs\ there\ any\ reason\ not\ to\ do\ it\ that\ way?\n\nGotisch\n----\n\[RS\]\ proposes\ this\ built-in\ way,\ waving\ many\ flags\ :)\n======\n\ %\ set\ a\ \[lsearch\ -all\ -inline\ -not\ -exact\ \$a\ b\]\n\ a\ c\ a\ c\ a\ c\n======\n\n\[wdb\]\ Simply\ ingenious!\n\n----\n\n\[@JaviGarate\]\ Awesome!\n\n----\nTodd\ A.\ Jacobs\ suggests\ this\ slightly\ more\ flexible\ version:\n\n======\n\ #\ lremove\ ?-all?\ list\ pattern\n\ #\n\ #\ Removes\ matching\ elements\ from\ a\ list,\ and\ returns\ a\ new\ list.\n\ proc\ lremove\ \{args\}\ \{\n\ \ \ \ \ if\ \{\[llength\ \$args\]\ <\ 2\}\ \{\n\ \ \ \ \ \ \ \ puts\ stderr\ \{Wrong\ #\ args:\ should\ be\ \"lremove\ ?-all?\ list\ pattern\"\}\n\ \ \ \ \ \}\n\ \ \ \ \ set\ list\ \[lindex\ \$args\ end-1\]\n\ \ \ \ \ set\ elements\ \[lindex\ \$args\ end\]\n\ \ \ \ \ if\ \[string\ match\ -all\ \[lindex\ \$args\ 0\]\]\ \{\n\ \ \ \ \ \ \ \ foreach\ element\ \$elements\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ list\ \[lsearch\ -all\ -inline\ -not\ -exact\ \$list\ \$element\]\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ #\ Using\ lreplace\ to\ truncate\ the\ list\ saves\ having\ to\ calculate\n\ \ \ \ \ \ \ \ #\ ranges\ or\ offsets\ from\ the\ indexed\ element.\ The\ trimming\ is\n\ \ \ \ \ \ \ \ #\ necessary\ in\ cases\ where\ the\ first\ or\ last\ element\ is\ the\n\ \ \ \ \ \ \ \ #\ indexed\ element.\n\ \ \ \ \ \ \ \ foreach\ element\ \$elements\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ idx\ \[lsearch\ \$list\ \$element\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ list\ \[string\ trim\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \"\[lreplace\ \$list\ \$idx\ end\]\ \[lreplace\ \$list\ 0\ \$idx\]\"\]\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \}\n\ \ \ \ \ return\ \$list\n\ \}\n\n\ #\ Test\ cases.\n\ set\ foo\ \{1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\}\n\ puts\ \"Foo:\ \[list\ \$foo\]\"\n\ puts\ \"Foo:\ replace\ one:\ \[lremove\ \$foo\ \$argv\]\"\n\ puts\ \"Foo:\ replace\ all:\ \[lremove\ -all\ \$foo\ \$argv\]\"\n\n\ puts\ \{\}\n\n\ set\ bar\ \{1\ 2\ 3\ 4\ 1\ 6\ 7\ 1\ 9\ 10\}\n\ puts\ \"Bar:\ \[list\ \$bar\]\"\n\ puts\ \"Bar:\ replace\ one:\ \[lremove\ \$bar\ \$argv\]\"\n\ puts\ \"Bar:\ replace\ all:\ \[lremove\ -all\ \$bar\ \$argv\]\"\n======\n\n\[dzach\]\ ...but\ then,\ when\ I\ do\ :\n======\n\ set\ bar\ \{1\ 2\ 3\ \{\}\ 4\ 1\ 6\ 7\ 1\ 9\ 10\ \{\}\}\n\ lremove\ -all\ \$bar\ \{\}\n======\nI\ still\ get:\n\ 1\ 2\ 3\ \{\}\ 4\ 1\ 6\ 7\ 1\ 9\ 10\ \{\}\n\n\[jmn\]\ \ this\ is\ because\ the\ proc\ expects\ a\ *list*\ of\ patterns\ as\ the\ 2nd\ argument.\nTry\ instead:\n======\n\ lremove\ -all\ \$bar\ \[list\ \{\}\]\ \n======\n\n\nI\ don't\ see\ why\ the\ complicated\ 'lreplace'\ line\ with\ the\ 'string\ trim'\ is\ required.\nAs\ far\ as\ I\ can\ see\ -\ it\ could\ be\ replaced\ with:\n======\n\ set\ list\ \[lreplace\ \$list\ \$idx\ \$idx\]\n======\n\n\nWhen\ removing\ a\ single\ value\ (1st\ encountered\ match)\ from\ a\ list\ -\ I\ use:\n======\n\ set\ posn\ \[lsearch\ -exact\ \$list\ \$val\]\n\ set\ list\ \[lreplace\ \$list\ \$posn\ \$posn\]\n======\n\nThis\ is\ slightly\ different\ in\ functionality\ from\ RS's\ beautiful\ one\ liner\ above,\ which\ removes\ all\ instances.\nIf\ you\ know\ you\ only\ have\ one\ instance\ of\ the\ value\ to\ be\ removed\ -\ this\ 2\ liner\ may\ be\ slightly\ faster\ on\ large\ lists\ (tested\ on\ Tcl8.6b1)..\ but\ on\ a\ 2007\ vintage\ machine\ we're\ talking\ maybe\ a\ couple\ of\ hundred\ microseconds\ for\ lists\ even\ of\ size\ approx\ 10K,\ so\ it's\ not\ likely\ to\ be\ an\ issue\ except\ for\ some\ pretty\ intensive\ inner\ loops\ with\ large\ lists.\n\n\[milarepa\]\ How\ about\ this:\n\n======\nproc\ lremove\ \{list\ match\}\ \{\n\ \ \ \ set\ idx_list\ \[lsearch\ -all\ \$list\ \$match\]\n\ \ \ \ foreach\ idx\ \[lreverse\ \$idx_list\]\ \{\n\ \ \ \ \ \ \ \ set\ list\ \[lreplace\ \$list\ \$idx\ \$idx\]\n\ \ \ \ \}\n\ \ \ \ return\ \$list\n\}\n======\n\[gold\]\ Multiple\ entries,\ using\ Suchenworth's\ idea:\n\n======\n\ \ \ \ \ \ \ \ \ \ \ \ \ #\ written\ on\ Windows\ XP\ on\ eTCL\n\ \ \ \ \ \ \ \ \ \ \ \ \ #\ working\ under\ TCL\ version\ 8.5.6\ and\ eTCL\ 1.0.1\n\ \ \ \ \ \ \ \ \ \ \ \ \ #\ gold\ on\ TCL\ WIKI\ ,\ 3jul2013\n\ \ \ \ \ \ \ \ package\ require\ Tk\n\ \ \ \ \ \ \ \ proc\ cleaner\ \{target\ args\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ res\ \$target\n\ \ \ \ \ \ \ \ \ \ \ \ foreach\ unwant\ \$args\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ suchenworth\ idea\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ res\ \[lsearch\ -all\ -inline\ -not\ -exact\ \$res\ \$unwant\ \]\n\ \ \ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \ \ \ \ return\ \$res\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ console\ show\n\ \ \ \ \ \ \ \ set\ a_target_list\ \[list\ a\ b\ c\ a\ b\ c\ a\ b\ c\ 1234\ 1234\ 5678\]\n\ \ \ \ \ \ \ \ puts\ \"\ \[cleaner\ \{a\ b\ c\ a\ b\ c\ a\ b\ c\}\ b\ c\]\"\n\ \ \ \ \ \ \ \ puts\ \"\ \[cleaner\ \$a_target_list\ 1234\ 5678\]\"\n\n\ Output:\n\ a\ a\ a\n\ a\ b\ c\ a\ b\ c\ a\ b\ c\n======\n\nOther\ lremove\ methode,\ by\ \[CB\]\ :\n\n\ proc\ lremove\ \{l\ p\}\ \{\n\ \ \ \ \ \ \ \ set\ p\ \[lsearch\ -exact\ \$l\ \$p\]\n\ \ \ \ \ \ \ \ return\ \"\[lrange\ \$l\ 0\ \$p-1\]\ \[lrange\ \$l\ \$p+1\ end\]\"\n\ \}\n\n\ Example\ :\ \n\n\ set\ l\ \{a\ b\ c\ d\ e\}\n\ puts\ \[lremove\ \$l\ c\]\n\n\ Output:\n\n\ a\ b\ d\ e\n\n======\n\n----\nSee\ also\n\ \ \ *\ \[list\]\n\ \ \ *\ \[http://tip.tcl.tk/367.html%|%TIP\ #367\]\n\n<<categories>>\ Command regexp2} CALL {my render lremove How\ to\ remove\ items\ from\ a\ list\ not\ by\ their\ position\ (\[lreplace\])\ but\ by\ the\ actual\ content.\ \nMy\ solution\ would\ be:\n\n======\n\ proc\ K\ \{\ x\ y\ \}\ \{\ set\ x\ \}\n\ proc\ lremove\ \{\ listvar\ string\ \}\ \{\n\ \ \ \ \ \ \ \ \ upvar\ \$listvar\ in\n\ \ \ \ \ \ \ \ \ foreach\ item\ \[K\ \$in\ \[set\ in\ \[list\]\]\]\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ if\ \{\[string\ equal\ \$item\ \$string\]\}\ \{\ continue\ \}\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ lappend\ in\ \$item\n\ \ \ \ \ \ \ \ \ \}\n\ \}\n======\n\nwhich\ gives\ us\n\n\ %\ set\ a\ \[list\ a\ b\ c\ a\ b\ c\ a\ b\ c\]\n\ a\ b\ c\ a\ b\ c\ a\ b\ c\n\ %\ lremove\ a\ b\n\ %\ set\ a\n\ a\ c\ a\ c\ a\ c\n\nIs\ there\ any\ reason\ not\ to\ do\ it\ that\ way?\n\nGotisch\n----\n\[RS\]\ proposes\ this\ built-in\ way,\ waving\ many\ flags\ :)\n======\n\ %\ set\ a\ \[lsearch\ -all\ -inline\ -not\ -exact\ \$a\ b\]\n\ a\ c\ a\ c\ a\ c\n======\n\n\[wdb\]\ Simply\ ingenious!\n\n----\n\n\[@JaviGarate\]\ Awesome!\n\n----\nTodd\ A.\ Jacobs\ suggests\ this\ slightly\ more\ flexible\ version:\n\n======\n\ #\ lremove\ ?-all?\ list\ pattern\n\ #\n\ #\ Removes\ matching\ elements\ from\ a\ list,\ and\ returns\ a\ new\ list.\n\ proc\ lremove\ \{args\}\ \{\n\ \ \ \ \ if\ \{\[llength\ \$args\]\ <\ 2\}\ \{\n\ \ \ \ \ \ \ \ puts\ stderr\ \{Wrong\ #\ args:\ should\ be\ \"lremove\ ?-all?\ list\ pattern\"\}\n\ \ \ \ \ \}\n\ \ \ \ \ set\ list\ \[lindex\ \$args\ end-1\]\n\ \ \ \ \ set\ elements\ \[lindex\ \$args\ end\]\n\ \ \ \ \ if\ \[string\ match\ -all\ \[lindex\ \$args\ 0\]\]\ \{\n\ \ \ \ \ \ \ \ foreach\ element\ \$elements\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ list\ \[lsearch\ -all\ -inline\ -not\ -exact\ \$list\ \$element\]\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ #\ Using\ lreplace\ to\ truncate\ the\ list\ saves\ having\ to\ calculate\n\ \ \ \ \ \ \ \ #\ ranges\ or\ offsets\ from\ the\ indexed\ element.\ The\ trimming\ is\n\ \ \ \ \ \ \ \ #\ necessary\ in\ cases\ where\ the\ first\ or\ last\ element\ is\ the\n\ \ \ \ \ \ \ \ #\ indexed\ element.\n\ \ \ \ \ \ \ \ foreach\ element\ \$elements\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ idx\ \[lsearch\ \$list\ \$element\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ list\ \[string\ trim\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \"\[lreplace\ \$list\ \$idx\ end\]\ \[lreplace\ \$list\ 0\ \$idx\]\"\]\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \}\n\ \ \ \ \ return\ \$list\n\ \}\n\n\ #\ Test\ cases.\n\ set\ foo\ \{1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\}\n\ puts\ \"Foo:\ \[list\ \$foo\]\"\n\ puts\ \"Foo:\ replace\ one:\ \[lremove\ \$foo\ \$argv\]\"\n\ puts\ \"Foo:\ replace\ all:\ \[lremove\ -all\ \$foo\ \$argv\]\"\n\n\ puts\ \{\}\n\n\ set\ bar\ \{1\ 2\ 3\ 4\ 1\ 6\ 7\ 1\ 9\ 10\}\n\ puts\ \"Bar:\ \[list\ \$bar\]\"\n\ puts\ \"Bar:\ replace\ one:\ \[lremove\ \$bar\ \$argv\]\"\n\ puts\ \"Bar:\ replace\ all:\ \[lremove\ -all\ \$bar\ \$argv\]\"\n======\n\n\[dzach\]\ ...but\ then,\ when\ I\ do\ :\n======\n\ set\ bar\ \{1\ 2\ 3\ \{\}\ 4\ 1\ 6\ 7\ 1\ 9\ 10\ \{\}\}\n\ lremove\ -all\ \$bar\ \{\}\n======\nI\ still\ get:\n\ 1\ 2\ 3\ \{\}\ 4\ 1\ 6\ 7\ 1\ 9\ 10\ \{\}\n\n\[jmn\]\ \ this\ is\ because\ the\ proc\ expects\ a\ *list*\ of\ patterns\ as\ the\ 2nd\ argument.\nTry\ instead:\n======\n\ lremove\ -all\ \$bar\ \[list\ \{\}\]\ \n======\n\n\nI\ don't\ see\ why\ the\ complicated\ 'lreplace'\ line\ with\ the\ 'string\ trim'\ is\ required.\nAs\ far\ as\ I\ can\ see\ -\ it\ could\ be\ replaced\ with:\n======\n\ set\ list\ \[lreplace\ \$list\ \$idx\ \$idx\]\n======\n\n\nWhen\ removing\ a\ single\ value\ (1st\ encountered\ match)\ from\ a\ list\ -\ I\ use:\n======\n\ set\ posn\ \[lsearch\ -exact\ \$list\ \$val\]\n\ set\ list\ \[lreplace\ \$list\ \$posn\ \$posn\]\n======\n\nThis\ is\ slightly\ different\ in\ functionality\ from\ RS's\ beautiful\ one\ liner\ above,\ which\ removes\ all\ instances.\nIf\ you\ know\ you\ only\ have\ one\ instance\ of\ the\ value\ to\ be\ removed\ -\ this\ 2\ liner\ may\ be\ slightly\ faster\ on\ large\ lists\ (tested\ on\ Tcl8.6b1)..\ but\ on\ a\ 2007\ vintage\ machine\ we're\ talking\ maybe\ a\ couple\ of\ hundred\ microseconds\ for\ lists\ even\ of\ size\ approx\ 10K,\ so\ it's\ not\ likely\ to\ be\ an\ issue\ except\ for\ some\ pretty\ intensive\ inner\ loops\ with\ large\ lists.\n\n\[milarepa\]\ How\ about\ this:\n\n======\nproc\ lremove\ \{list\ match\}\ \{\n\ \ \ \ set\ idx_list\ \[lsearch\ -all\ \$list\ \$match\]\n\ \ \ \ foreach\ idx\ \[lreverse\ \$idx_list\]\ \{\n\ \ \ \ \ \ \ \ set\ list\ \[lreplace\ \$list\ \$idx\ \$idx\]\n\ \ \ \ \}\n\ \ \ \ return\ \$list\n\}\n======\n\[gold\]\ Multiple\ entries,\ using\ Suchenworth's\ idea:\n\n======\n\ \ \ \ \ \ \ \ \ \ \ \ \ #\ written\ on\ Windows\ XP\ on\ eTCL\n\ \ \ \ \ \ \ \ \ \ \ \ \ #\ working\ under\ TCL\ version\ 8.5.6\ and\ eTCL\ 1.0.1\n\ \ \ \ \ \ \ \ \ \ \ \ \ #\ gold\ on\ TCL\ WIKI\ ,\ 3jul2013\n\ \ \ \ \ \ \ \ package\ require\ Tk\n\ \ \ \ \ \ \ \ proc\ cleaner\ \{target\ args\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ res\ \$target\n\ \ \ \ \ \ \ \ \ \ \ \ foreach\ unwant\ \$args\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ suchenworth\ idea\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ res\ \[lsearch\ -all\ -inline\ -not\ -exact\ \$res\ \$unwant\ \]\n\ \ \ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \ \ \ \ return\ \$res\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ console\ show\n\ \ \ \ \ \ \ \ set\ a_target_list\ \[list\ a\ b\ c\ a\ b\ c\ a\ b\ c\ 1234\ 1234\ 5678\]\n\ \ \ \ \ \ \ \ puts\ \"\ \[cleaner\ \{a\ b\ c\ a\ b\ c\ a\ b\ c\}\ b\ c\]\"\n\ \ \ \ \ \ \ \ puts\ \"\ \[cleaner\ \$a_target_list\ 1234\ 5678\]\"\n\n\ Output:\n\ a\ a\ a\n\ a\ b\ c\ a\ b\ c\ a\ b\ c\n======\n\nOther\ lremove\ methode,\ by\ \[CB\]\ :\n\n\ proc\ lremove\ \{l\ p\}\ \{\n\ \ \ \ \ \ \ \ set\ p\ \[lsearch\ -exact\ \$l\ \$p\]\n\ \ \ \ \ \ \ \ return\ \"\[lrange\ \$l\ 0\ \$p-1\]\ \[lrange\ \$l\ \$p+1\ end\]\"\n\ \}\n\n\ Example\ :\ \n\n\ set\ l\ \{a\ b\ c\ d\ e\}\n\ puts\ \[lremove\ \$l\ c\]\n\n\ Output:\n\n\ a\ b\ d\ e\n\n======\n\n----\nSee\ also\n\ \ \ *\ \[list\]\n\ \ \ *\ \[http://tip.tcl.tk/367.html%|%TIP\ #367\]\n\n<<categories>>\ Command} CALL {my revision lremove} CALL {::oo::Obj4003754 process revision/lremove} CALL {::oo::Obj4003752 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