*** Welcome to piglix ***

Symbol (Lisp)


A symbol in computer programming is a primitive datatype whose instances have a unique human-readable form. Symbols can be used as identifiers. In some programming languages, they are called atoms.

In the most trivial implementation, they are essentially named integers (e.g. the enumerated type in C).

The following programming languages provide support for symbols:

A symbol in Lisp is unique in a namespace (or package in Common Lisp). Symbols can be tested for equality with the function EQ. Lisp programs can generate new symbols at runtime. When Lisp reads data that contains textual represented symbols, existing symbols are referenced. If a symbol is unknown, the Lisp reader creates a new symbol.

In Common Lisp symbols have the following attributes: a name, a value, a function, a list of properties and a package.

In Common Lisp it is also possible that a symbol is not interned in a package. Such symbols can be printed, but when read back, a new symbol needs to be created. Since it is not *interned*, the original symbol can't be retrieved from a package.

In Common Lisp symbols may use any characters, including whitespace, such as spaces and newlines. If a symbol contains a whitespace character it needs to be written as |this is a symbol|. Symbols can be used as identifiers for any kind of named programming constructs: variables, functions, macros, classes, types, goto tags and more. Symbols can be interned in a package. Keyword symbols are self-evaluating and interned in the package named KEYWORD.

The following is a simple external representation of a Common Lisp symbol:

Symbols can contain whitespace (and all other characters):

In Common Lisp symbols with a leading colon in their printed representations are keyword symbols. These are interned in the keyword package.


...
Wikipedia

...