Are there any differences between what in Common Lisp you'd call an atom, and a symbol?
Do these differences extend to other languages in the Lisp family?
(I'm aware that atom has a different meaning in Clojure, but I'm interested in the boundaries of what is a symbol.)
In Lisp, all of the quoted text including the punctuation mark and the blank spaces is a single atom. This kind of atom is called a string (for “string of characters”) and is the sort of thing that is used for messages that a computer can print for a human to read.
Basic Building Blocks in LISPAn atom is a number or string of contiguous characters. It includes numbers and special characters.
Advertisements. In LISP, a symbol is a name that represents data objects and interestingly it is also a data object. What makes symbols special is that they have a component called the property list, or plist.
In Common Lisp, atom is precisely defined as any object that is not a cons. See http://l1sp.org/cl/atom for more details.
I don't know about other languages in the Lisp family.
'atom' is usually seen from list processing. In Common Lisp something is either a non-empty list or an atom. In former times an atom was also called 'atomic symbol', which is something slightly different. Now in Common Lisp atoms are not only symbols, but everything else which is not a cons cell (examples: strings, numbers, hashtables, streams, ...).
If something is not an atom (is a cons), the operations CAR, CDR, FIRST and REST can be used.
So atom is a group of data structure. A symbol is a certain data structure, which also happens to be an atom.
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