AMB: Based on a discussion on the Expanding the Expansion Prefix, the possibility of adding a math function that simply returns the arguments was proposed as a solution to eliminating multiple expr calls for arguments in a command.
proc tcl::mathfunc::list {args} {return $args}This construct allows an expression to return a list of evaluated expressions.
expr {list($x+1, $y*2, $x-$y)}Vs.
list [expr {$x+1}] [expr {$y*2}] [expr {$x-$y}]However, I feel like this is just a work-around. Ideally, I'd like the expr command to take multiple arguments separated by commas and return the result.
expr {$x+1, $y*2, $x-$y}; # currently returns an error.KSA: I like the idea. There's a small catch however when using
proc ::tcl::mathfunc::list {args} {return $args}It redirects the list command within the ::tcl::mathfunc namespace. At least one have to be aware of that and need to fully qualify it as ::list if the global command is needed.