Buy the book!
|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
A "generalized variable" or "place form" is one of the many places in Lisp memory where values can be stored. The simplest place form is a regular Lisp variable. But the cars and cdrs of lists, elements of arrays, properties of symbols, and many other locations are also places where Lisp values are stored.
setf form is like
setq, except that it accepts
arbitrary place forms on the left side rather than just
symbols. For example,
(setf (car a) b) sets the car of
b, doing the same operation as
(setcar a b)
but without having to remember two separate functions for setting
and accessing every type of place.
Generalized variables are analogous to "lvalues" in the C
language, where `x = a[i]' gets an element from an array
and `a[i] = x' stores an element using the same notation.
Just as certain forms like
a[i] can be lvalues in C, there
is a set of forms that can be generalized variables in Lisp.
5.2.1 Basic Setf `setf' and place forms 5.2.2 Modify Macros `incf', `push', `rotatef', `letf', `callf', etc. 5.2.3 Customizing Setf `define-modify-macro', `defsetf', `define-setf-method'
|webmaster donations bookstore||delorie software privacy|
|Copyright © 2003 by The Free Software Foundation||Updated Jun 2003|