lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Considering it is in the 'math' library, I would think that the second method be more preferred as it is more related to number values. Although, the first one definitely has its share of uses as well.


On Wed, Apr 9, 2014 at 4:32 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
The present specification says math.min(x,...) and math.max(x,...), so
that there must be at least one argument, which must be a number.

There are two ways of having a more general construction.

1. If the argument list always has a first element, there is no reason to
stay with numbers. Anything for which less-than is defined can work.

2. If the arguments are constrained to be numbers, there is no reason
to insist on having at least one argument. math.min over an empty list
is math.huge, math.max over an empty list is -math.huge.