CMcC {et al} 2008-07-08:
Tcl contains some semantic equivalences. ~~ can be read as approximates. Add more if you find them. The idea is to find cases where there is more than one way to do it. The hunt is on.
In the following examples, lindex is used as the identity command, i.e., a command that returns its argument, verbatim.
Example: Given
set abc 123
The following command are equivalent
set xyz $abc set xyz [set abc]
Example:
Using string can result in quoting hell for some strings while using subst is more verbose but "cleaner".
[replace with example]
Example:
#given set colors {taupe puce heliotrope} set countries {Djibouti Brazil Azerbaijan} #equivalents set var "$colors $countries" set var [concat $colors $countries] set var [list {*}$colors {*}$countries] set var [string cat $colors { } $countries]
Example:
set var "1 2 3" set var {1 2 3} set var 1\ 2\ 3 set var [list 1 2 3]
upvar #0 varname varname ~~ ::varname
Example:
set abc $::env(HOME)
or
global env upvar #0 env env2 set abc $env(HOME) set abc2 $env2(HOME)