This is output of erlang shell:
1> atom.
atom
2> next_atom.
next_atom
3> atom@erlang.
atom@erlang
4> 'atom in single quotes'.
'atom in single quotes'
5> atom = 'atom'.
atom
6> a.tom.
'a.tom'
7> a..tom.
* 1: syntax error before: '..'
When there is just one dot .
within atom (line 6), I get no errors. However, when there is ..
, I get syntax error. Does ..
have some special meaning in Erlang or why do I get error when .
works fine?
An atom is to be enclosed in single quotes (') if it does not begin with a lower-case letter or if it contains other characters than alphanumeric characters, underscore (_), or @. The following program is an example of how atoms can be used in Erlang. This program declares 3 atoms, atom1, atom_1 and ‘atom 1’ respectively.
There is a (erlang runtime instance-) atom table. Atom string literal is only stored once. Atoms take 1 word. To me, this leaves a lot of things in the unclear. Is the atom word value always the same, independent of the sequence modules are loaded into a runtime instance?
Following are the relational operators available in Erlang. Checks to see if the left object is less than the right operand. Checks to see if the left object is less than or equal to the right operand. Checks to see if the left object is greater than the right operand.
An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. Erlang language supports the normal Arithmetic operators as any the language.
Dots are not allowed as such in atoms, but a dot between two atoms: 'foo'.'bar'
,
is a compile time operator that concatenates the atoms to 'foo.bar'
.
This is an extension which was made to support the (still not officially supported) Java-like package system. That's why it's not documented.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With