Convenience functions

invoke vars cmd ...
invoke simply evals $cmd in a private space. This eg. allows using temporary variables in bindings without creating these in global scope. It is also very convenient to use values appended to a command given to a binding: Further arguments (when given) are parameters that will be available in the variables given in vars. If more parameters are supplied than vars are given, the remaining parameters will be stored in the variable args.
list_iterate variableName list
debugging tool to interactively iterate a variable over a list. list_iterate is used to initialise and it sets the variable to the first element of the list. Every 'list_next variableName' will puts the next element into the variable.
list_next variableName
complement to list_iterate. sets the variable to the next element of the list first given by list_iterate.
aproc args body
aproc creates an 'anonymous' procedure; this means you don't have to provide a name. It returns the name to invoke it. These procedures are cached based on the arguments and body. This is actually somewhat similar to the invoke command, but is faster when the proc is being reused many times. Typical use would be in parameters that expect a command name that will be called later with a number of arguments: .ctable configure -getcommand [aproc {args} {return $args}]
? expr truevalue falsevalue
? expr truevalue falsevalue
echo string
echo returns its argument as a result This is useful when you want a command that will be evalled or upleveled to return a certain value
get varName ?default?
get returns the value of the variable given by varName if it exists. If the variable does not exists, it returns an empty string, or value given by $default if present
rem args
does nothing
I use this to put some example or testing code in a program without all the #'s
REM args
when the procedure remof is called, REM will also do nothing when the procedure remon is called, REM will put its arguments to the stdout
true expression
true expr returns 1 when expression is yes, true or 1
otherwise it returns 0.
setglobal varName ?newValue?
same as the set command, but then for global variables
random min max
returns a random number between min and max
putsvars varname ?varname ...?
returns the values of the given variables in the form:
set variable1 value1
set variable2 value2
error_preserve
preserves the error information in the variables errorInfo. Preserved information will be restored with the command error_restore
today
returns current time in astronomical format: "%Y-%m-%d %H:%M:%S"
varsubst string varlist valuelist
substitutes only the variables in varlist for their content in the given string
eg.:
	% set try {try it}
	try it
	% varsubst {try} {
		puts [list $try $try2]
	}
		puts [list {try it} $try2]