Term Comparisons
There are eight possible term comparison operations, shown in Table 6, Term comparisons.
For the purposes of comparison, a total ordering is defined over all terms. This is defined so that the following is true:
number < atom < reference < fun < port < pid
< tuple (and record) < map < list < binary
This means that, for example, a number (any number) is defined to be smaller than an atom (any atom), that a tuple is greater than an atom, and so on. (Note that for the purposes of ordering, ports and PIDs are included in this list. We’ll talk about these later.)
Having a total order over all terms means we can sort lists of any type and build efficient data access routines based on the sort order of the keys.
All the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access