ToC DocOverview CGDoc RelNotes Index PermutedIndex
Allegro CL
Home Previous Up Next Table of Contents Index
  ANSI Common Lisp   2 Syntax   2.3 Interpretation of Tokens

2.3.4 Symbols as Tokens

Any token that is not a potential number, does not contain a package marker, and does not consist entirely of dots will always be interpreted as a symbol. Any token that is a potential number but does not fit the number syntax is a reserved token and has an implementation-dependent interpretation. In all other cases, the token is construed to be the name of a symbol.

Examples of the printed representation of symbols are in the next figure. For presentational simplicity, these examples assume that the readtable case of the current readtable is :upcase.

Examples of the printed representation of symbols (Part 1 of 2)
FROBBOZ The symbol whose name is FROBBOZ.
frobboz Another way to notate the same symbol.
fRObBoz Yet another way to notate it.
unwind-protect A symbol with a hyphen in its name.
+$ The symbol named +$.
1+ The symbol named 1+.
+1 This is the integer 1, not a symbol.
pascal_style This symbol has an underscore in its name.
file.rel.43 This symbol has periods in its name.
\( The symbol whose name is (.
\+1 The symbol whose name is +1.
+\1 Also the symbol whose name is +1.
\frobboz The symbol whose name is fROBBOZ.
3.14159265\s0 The symbol whose name is 3.14159265s0.
3.14159265\S0 A different symbol, whose name is 3.14159265S0.
3.14159265s0 A possible short float approximation to pi .

Examples of the printed representation of symbols (Part 2 of 2)
APL\\360 The symbol whose name is APL\360.
apl\\360 Also the symbol whose name is APL\360.
\(b^2\)\ -\ 4*a*c The name is (B^2) - 4*A*C.
Parentheses and two spaces in it.
\(\b^2\)\ -\4*\a*\c The name is (b^2) - 4*a*c.
Letters explicitly lowercase.
|"| The same as writing \".
|(b^2) - 4*a*c| The name is (b^2) - 4*a*c.
|frobboz| The name is frobboz, not FROBBOZ.
|APL\360| The name is APL360.
|APL\\360| The name is APL\360.
|apl\\360| The name is apl\360.
|\|\|| Same as \|\| - the name is ||.
|(B^2) - 4*A*C| The name is (B^2) - 4*A*C.
Parentheses and two spaces in it.
|(b^2) - 4*a*c| The name is (b^2) - 4*a*c.

In the process of parsing a symbol, it is implementation-dependent which implementation-defined attributes are removed from the characters forming a token that represents a symbol.

When parsing the syntax for a symbol, the Lisp reader looks up the name of that symbol in the current package. This lookup may involve looking in other packages whose external symbols are inherited by the current package. If the name is found, the corresponding symbol is returned. If the name is not found (that is, there is no symbol of that name accessible in the current package), a new symbol is created and is placed in the current package as an internal symbol. The current package becomes the owner (home package) of the symbol, and the symbol becomes interned in the current package. If the name is later read again while this same package is current, the same symbol will be found and returned.


Home Previous Up Next Table of Contents Index
© Franz Inc. 1998-2015 - File last updated 03-23-2015