min

In Tcl 8.5, the expr command has a variadic min() function.

 % expr min(5,1,4,2,3)
 1

 % expr min(5,1.1,-17.345,1e10)
 -17.345

Like all math functions in Tcl 8.5, it is available as a command

 % namespace import ::tcl::mathfunc::min
 % min 5 1 4 2 3
 1

This does not work in releases up to 8.5.4 because max and min are not importable. This should be fixed in subsequent versions.

RS 2008-09-19: Before that, you can hot-patch it yourself in one line of code:

 namespace eval tcl::mathfunc namespace export max min ;# this is it
 namespace import tcl::mathfunc::min

All arguments to the min must be able to be interpreted as numeric. Otherwise, you get this sort of error:

 % expr min("non-numeric")
 expected floating-point number but got "non-numeric"

DKF: It was also a command and function in TclX.