{"id":6201,"date":"2022-12-20T18:58:01","date_gmt":"2022-12-20T21:58:01","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/tailcall-mann\/"},"modified":"2022-12-20T18:58:01","modified_gmt":"2022-12-20T21:58:01","slug":"tailcall-mann","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/tailcall-mann\/","title":{"rendered":"tailcall (mann)"},"content":{"rendered":"<h1 align=\"center\">tailcall<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#EXAMPLE\">EXAMPLE<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#KEYWORDS\">KEYWORDS<\/a> <\/p>\n<hr>\n<p>______________________________________________________________________________<\/p>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">tailcall \u2212 Replace the current procedure with another command<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>tailcall<\/b> <i>command<\/i> ?<i>arg &#8230;<\/i>? ______________________________________________________________________________<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>tailcall<\/b> command replaces the currently executing procedure, lambda application, or method with another command. The <i>command<\/i>, which will have <i>arg &#8230;<\/i> passed as arguments if they are supplied, will be looked up in the current namespace context, not in the caller\u2019s. Apart from that difference in resolution, it is equivalent to:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">return [uplevel 1 [list <i>command<\/i> ?<i>arg &#8230;<\/i>?]]<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This command may not be invoked from within an <b>uplevel<\/b> into a procedure or inside a <b>catch<\/b> inside a procedure or lambda.<\/p>\n<h2>EXAMPLE <a name=\"EXAMPLE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Compute the factorial of a number.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">proc factorial {n {accum 1}} { <br \/> if {$n < 2} { <br \/> return $accum <br \/> } <b><br \/> tailcall<\/b> factorial [expr {$n &#8211; 1}] [expr {$accum bodies manpages.csv script_extrae_body.sh script.sh usr $n}] <br \/> }<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Print the elements of a list with alternating lines having different indentations.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">proc printList {theList} { <br \/> if {[llength $theList]} { <br \/> puts &#8220;> [lindex $theList 0]&#8221; <b><br \/> tailcall<\/b> printList2 [lrange $theList 1 end] <br \/> } <br \/> } <br \/> proc printList2 {theList} { <br \/> if {[llength $theList]} { <br \/> puts &#8220;< [lindex $theList 0]\" <b><br \/> tailcall<\/b> printList [lrange $theList 1 end] <br \/> } <br \/> }<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">apply(n), proc(n), uplevel(n)<\/p>\n<h2>KEYWORDS <a name=\"KEYWORDS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">call, recursion, tail recursion<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  tailcall \u2212 Replace the current procedure with another command <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3783,1],"tags":[2635,2832],"class_list":["post-6201","post","type-post","status-publish","format-standard","hentry","category-n-comandos-tcl-tk","category-sin-categoria","tag-mann","tag-tailcall"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=6201"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6201\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}