string cat on 8.6.1

In my Linux Mint, Tcl/Tk 8.6.1 is pre-installed, and Iʼm not willed to install manually a newer version. But, Iʼd like to have string cat subcommand. This happens on try:

 % info patchlevel
 8.6.1
 % string cat a b c
 unknown or ambiguous subcommand "cat": must be bytelength, compare, (... cut off)
 % 

The string command is made by namespace ensemble so I add this sub-command if not yet existing:

if {[info command ::tcl::string::cat] eq ""} then {
  proc ::tcl::string::cat args {::join $args ""}
  apply {
    map {
      dict set map cat ::tcl::string::cat
      namespace ensemble configure string -map $map
    }
  } [namespace ensemble configure string -map] 
}

From now on it woks on my Tcl installation.

 % string cat a b c
 abc
 % 

Done.


AMG: See also ensemble extend for more information on adding commands to an ensemble.