[erlang-questions] {1} > 100 returns true ?!

Matthew Palmer mpalmer@REDACTED
Sat May 16 05:03:00 CEST 2009


On Fri, May 15, 2009 at 11:58:44PM +0200, Robert Virding wrote:
> 2009/5/15 Michael McDaniel <erlangy@REDACTED>
> 
> >
> >  Per documentation in the reference manual section 6.11 Term Comparison,
> >  numbers compare less than tuples ...
> >
> > "The arguments may be of different data types.
> >  The following order is defined:
> > number < atom < reference < fun < port < pid < tuple < list < bit string"
> >
> > If you are asking *why* that design decision was made, I do not know.
> >
> 
> It was practical and useful to do so, and there was no real reason to
> restrict it. What might have been better, 20/20 hindsight, would have been
> to have 2 separate sets of comparison functions, those that work on anything
> and those that only work on numbers.

On the other hand, it's trivial to ensure that you've got the right types
before you start comparing things.

- Matt



More information about the erlang-questions mailing list