A symbol or id 2 in LISP is a unit which has a name, in the standard case beginning with a letter and followed by letters and digits. Special characters in a name or a leading digit have to be flagged by a preceding exclamation mark. Symbols are the same entities as in algebraic mode. Symbols are unique in the system. You may view a symbol as a data structure with four slots, the name with is always a string, the value cell to store assigned values, the function cell 3 to point to an assigned program structure and the property cell as anchor of the property list. Initially all cells except the name cell are marked empty.
In contrast to algebraic mode in LISP, only integers and floating point numbers (which don’t exist in that form in algebraic mode) are considered as numbers. All other numeric quantities from algebraic mode such as rationals, rounded numbers, Gaussian integers are composite data structures encoded in the REDUCE domain structure (see below).
Just as in algebraic mode, a sequence of characters enclosed in string quotes is a string. Functions for manipulating symbols, numbers and strings are4 :
|idp(q)||true if q is a symbol|
|numberp(q)||true if q is a number|
|stringp(q)||true if q is a string|
|liter(q)||true if q is a single alphabetic character symbol|
|digit(q)||true if a is a digit character symbol|
|intern(s)||make a symbol from a string|
|explode(a)||decompose a symbol/number/string into its characters|
|explode2(a)||explode, but without escape characters|
|compress(l)||make a symbol/number/string from a list of characters|
|gensym()||generate a new symbol|
The functions gensym and compress make symbols which are not yet “internal”: they are unique, but there may be other symbols with the same name. It makes debugging especially hard if you cannot access the symbol by its name of course. The function intern can be used to convert such a symbol into an internal one - then every reference to the symbol name guarantees access to the desired object.