Common Lisp the Language, 2nd Edition


next up previous contents index
Next: Reference Up: Control Structure Previous: Control Structure

7.1. Constants and Variables

Because some Lisp data objects are used to represent programs, one cannot always notate a constant data object in a program simply by writing the notation for the object unadorned; it would be ambiguous whether a constant object or a program fragment was intended. The quote special form resolves this ambiguity.

There are two kinds of variables in Common Lisp, in effect: ordinary variables and function names. There are some similarities between the two kinds, and in a few cases there are similar functions for dealing with them, for example boundp and fboundp. However, for the most part the two kinds of variables are used for very different purposes: one to name defined functions, macros, and special forms, and the other to name data objects.

change_begin
X3J13 voted in March 1989 (FUNCTION-NAME)   to introduce the concept of a function-name, which may be either a symbol or a two-element list whose first element is the symbol setf and whose second element is a symbol. The primary purpose of this is to allow setf expander functions to be CLOS generic functions with user-defined methods. Many places in Common Lisp that used to require a symbol for a function name are changed to allow 2-lists as well; for example, defun is changed so that one may write (defun (setf foo) ...), and the function special form is changed to accept any function-name. See also fdefinition.

By convention, any function named (setf f) should return its first argument as its only value, in order to preserve the specification that setf returns its newvalue. See setf.

Implementations are free to extend the syntax of function-names to include lists beginning with additional symbols other than setf or lambda.
change_end




next up previous contents index
Next: Reference Up: Control Structure Previous: Control Structure


AI.Repository@cs.cmu.edu