3 ms·
x means "the symbol whose name is x". Symbols are first-class data structures in Lisp; they are basically C structs with a predefined structure, one of whose fi
by dreamcompiler 7y ago
x means "the symbol whose name is x". Symbols are first-class data structures in Lisp; they are basically C structs with a predefined structure, one of whose fields is called "name" which contains a string. (The other fields are unimportant for this discussion.) Symbols are looked up by their name, so there can only be one symbol whose name is "x" (not completely true but true enough for this discussion).
(x) means "a list that contains the symbol whose name is x." Lists are also first-class objects in Lisp, and they are built using cons cells. A cons cell is itself a struct with precisely two fields: a CAR and a CDR. And you can put anything in either field, including a pointer to another cons cell. The x symbol in this example would be pointed to by the CAR of a cons cell, and the symbol NIL (a special global symbol) would be pointed to by its CDR to indicate "the end of the list."
So (x) means a struct whose CAR contains a pointer to the symbol named "x" and whose CDR contains a pointer to the symbol named NIL. Otherwise known as a list with one element.