tuple comparison

Richard A. O'Keefe <>
Thu Jul 28 04:26:49 CEST 2005


	2. What's the meaning of such a result:
	
	53> {1, 2, 3} > 10.
	true
	
It's defined in the book.  (Section 2.5.6.)

    For the purpose of comparison the following ordering is defined:
	number < atom < reference < port < pid < tuple < list
    Tuples are ordered first by their size then by their elements.
    Lists are ordered by comparing heads, then tails.

	I would think that this comparison should throw an exception.
	
It is *AMAZINGLY* useful to have a total order on terms.  It means you
can sort any collection of terms.  It means that ordering is well defined
in ets/dets/mnesia.




More information about the erlang-questions mailing list