Bart Lateur wrote:
> On Tue, 08 Aug 2000 23:43:26 -0400, Ken Fox wrote:
> >(assuming min() is polymorphic):
> >
> > min($a, $b) eq $a
> >
> >Ugly, but minimal changes to the language.
>
> We could adopt a syntax similar to sort():
>
> $lowest = min($x, $y, $z); # default: numerical (?)
>
> $first = min { $a cmp $b } ($x, $y, $z); # alphabetical
That's missing the point that min() should be polymorphic and
information preserving though. I think min() should attempt to
downcast it's arguments until they are either the same type or
information would be lost. If information would be lost, then
upcast the simpler one to the other.
The definition of "information loss" is slippery though. The
string "10.0" has more information than 10 or even 10.0 (stored
as a fixed precision float). IMHO we could come up with a practical
definition that made generic algorithms possible.
- Ken