TIP 255: Add 'min' and 'max' [expr] Functions

Abstract

This TIP proposes enhancing the Tcl expr command with min
and max functions.

Rationale

Many programs need to find the minimum or maximum of a set of numbers,
so having functions to do this will make many script programmers'
lives easier. This will be adopting yet another feature from TclX, but
with the minor enhancement of being able to handle arbitrary numbers
of arguments.

Specification

The min and max functions shall be created using Tcl
commands (in a namespace such all namespaces will pick them up by
default) in the new 8.5 expr function style (see [232]). They
will take one or more numeric arguments (of any valid numeric type)
and return the minimum or maximum value of those numbers (depending on
which function was invoked).