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

Joe Armstrong <>
Mon May 18 12:54:56 CEST 2009


The original reason was that there should be a defined total order
over all terms (why? - so that we could write generic sorting
algorithms that could
order *any* terms).

The actual order was based on the idea of "complexity" an integer
is "simpler" than an atom. a tuple is simpler than a list and so on..

There was no real definition of "simpler" it was more or less the size
that an object took
in memory (by which measure [], should have been smallest, but is not :-).

The actual order is not important - but that a total ordering is well
defined is important.

/Joe


On Sun, May 17, 2009 at 9:40 PM, Francesco Cesarini (Erlang Training
and Consulting) <> wrote:
> Hi Steve,
>
> This has to do with the lexicographical order of Erlang types.
>
> number < atom < reference < fun < port < pid < tuple < list < bit string
>
> Francesco
>
>
> Steve Kirsch wrote:
>> i must admit I am a bit baffled by why this isn't an error:
>>
>> 4> {1,3} > 100.
>> true
>> 5> {1} >100.
>> true
>> 6>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list