Previous: The Lisp Reader, Up: Introduction [Contents][Index]
Certain characters are used in special ways in the syntax of Common Lisp. The complete syntax is explained in detail in chapter 22, but a quick summary here may be useful:
begins a list of items. The list may contain any number of items, including zero. Lists may be nested.
(cons (car x) (cdr y))
is a list of three things, of which
the last two are themselves lists.
ends a list of items.
(also called single quote or apostrophe) followed by an expression form is an
abbreviation for (quote form)
. Thus 'foo
means (quote foo)
and '(cons
'a 'b)
means (quote (cons (quote a) (quote b)))
.
the comment character. It and all characters up to the end of the line are discarded.
surround character strings:
"This is a thirty-nine-character string."
is an escape character. It causes the next character to be treated as a letter rather than for its usual syntactic purpose.
are used in pairs to surround the name (or part of the name) of a symbol that has many special characters in it. It is roughly equivalent to putting a backslash in front of every character so surrounded.
signals the beginning of a complicated syntactic structure. The next character designates the precise syntax to follow.
signals that the next expression is a template that may contain commas. The backquote syntax represents a program that will construct a data structure according to the template.
are used within the backquote syntax.
is used to indicate which package a symbol belongs to. For example,
network:reset
denotes the symbol named reset
in the package named
network
.
Brackets, braces, question mark, and exclamation point (that is, ‘[’, ‘]’, ‘{’, ‘}’, ‘?’, and ‘!’) are not used for any purpose in standard Common Lisp syntax. These characters are explicitly reserved to the user, primarily for use as macro characters for user-defined lexical syntax extensions.
All code in this book is written using lowercase letters. Common Lisp is generally insensitive to the case in which code is written.
Internally, names of symbols are ordinarily converted to and stored in uppercase form.
*print-case*
There are ways to force case conversion on output if desired; see
*print-case*
.
In this book, wherever an interactive exchange between a user and the Lisp system is shown, the input is exhibited with lowercase letters and the output with uppercase letters.
readtable-case
X3J13 voted in June 1989 (READ-CASE-SENSITIVITY) to introduce readtable-case. Certain settings allow the names of symbols to be case-sensitive. The default behavior, however, is as described in the previous paragraph. In any event, only uppercase letters appear in the internal print names of symbols naming the standard Common Lisp facilities described in this book.
Previous: The Lisp Reader, Up: Introduction [Contents][Index]