Common Lisp the Language, 2nd Edition

Next: Forms Up: Common Lisp the Language Previous: Type Upgrading

# 5. Program Structure

In chapter 2 the syntax was sketched for notating data objects in Common Lisp. The same syntax is used for notating programs because all Common Lisp programs have a representation as Common Lisp data objects.

Lisp programs are organized as forms and functions. Forms are evaluated (relative to some context) to produce values and side effects. Functions are invoked by applying them to arguments. The most important kind of form performs a function call; conversely, a function performs computation by evaluating forms.

In this chapter, forms are discussed first and then functions. Finally, certain ``top level'' special forms are discussed; the most important of these is `defun`, whose purpose is to define a named function.

- Forms
  - Self-Evaluating Forms
  - Variables
  - Special Forms
  - Macros
  - Function Calls
- Functions
  - Named Functions
  - Lambda-Expressions
- Top-Level Forms
  - Defining Named Functions
  - Declaring Global Variables and Named Constants
  - Control of Time of Evaluation