[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11. Variables

A variable is a name used in a program to stand for a value. Nearly all programming languages have variables of some sort. In the text of a Lisp program, variables are written using the syntax for symbols.

In Lisp, unlike most programming languages, programs are represented primarily as Lisp objects and only secondarily as text. The Lisp objects used for variables are symbols: the symbol name is the variable name, and the variable's value is stored in the value cell of the symbol. The use of a symbol as a variable is independent of its use as a function name. See section 8.1 Symbol Components.

The Lisp objects that constitute a Lisp program determine the textual form of the program--it is simply the read syntax for those Lisp objects. This is why, for example, a variable in a textual Lisp program is written using the read syntax for the symbol that represents the variable.

11.1 Global Variables  Variable values that exist permanently, everywhere.
11.2 Variables that Never Change  Certain "variables" have values that never change.
11.3 Local Variables  Variable values that exist only temporarily.
11.4 When a Variable is "Void"  Symbols that lack values.
11.5 Defining Global Variables  A definition says a symbol is used as a variable.
11.6 Tips for Defining Variables Robustly  Things you should think about when you define a variable.
11.7 Accessing Variable Values  Examining values of variables whose names are known only at run time.
11.8 How to Alter a Variable Value  Storing new values in variables.
11.9 Scoping Rules for Variable Bindings  How Lisp chooses among local and global values.
11.10 Buffer-Local Variables  Variable values in effect only in one buffer.
11.11 Frame-Local Variables  Variable values in effect only in one frame.
11.12 Possible Future Local Variables  New kinds of local values we might add some day.
11.13 File Local Variables  Handling local variable lists in files.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on May 2, 2002 using texi2html