[erlang-questions] Advanced Erlang Subtleties

Jeff Schultz jws@REDACTED
Fri May 20 05:45:35 CEST 2011


On Thu, May 19, 2011 at 11:02:35PM +0200, Joe Armstrong wrote:
> > I can see the equivalent evaluation of "250"<250 being a common mistake,
> > and always being false is hardly useful.

> A "<" B when A and B have different types means A is
> "less complex" than B. Lists and more complex than integers
> "250" is a list so "250"<250 is false.

> Suppose I want to make a Key-Value database, where the Key can be anything,
> including 250 and "250" to make any form of ordered tree we need a total
> order over all the keys.

Indeed.  If we can have only one built-in comparison, it needs to be
total over all values.  It is a pity that Prolog's distinction between
term comparison and number comparison wasn't carried over to Erlang :-(


    Jeff Schultz



More information about the erlang-questions mailing list