As far as I am aware, atoms in Erlang are stored as indices into the Atom Table, ie they are essentially numbers.
I want to calculate a hash value for a list which contains atoms, so ideally I would want to convert the atoms into numbers for processing. I am aware that the numbers can vary between VMs, but that is not relevant for my use case -- I am just looking for an easy way to convert them into numerical values.
I guess I could convert them back into lists or binaries (but those are then the lists of the characters making up the name) and use those values instead to calculate a hash value (essentially of the name of the atom).
So my questions are:
- Is it at all possible to access the internal (numerical) value of an atom?
- Should I not worry about this at all and instead use the
atom_to_listfunction, which will probably only be marginally slower?