Skip to main content

13 Functions

A Lisp program is composed mainly of Lisp functions. This chapter explains what functions are, how they accept arguments, and how to define them.

• What Is a Function  Lisp functions vs. primitives; terminology.
• Lambda Expressions  How functions are expressed as Lisp objects.
• Function Names  A symbol can serve as the name of a function.
• Defining Functions  Lisp expressions for defining functions.
• Calling Functions  How to use an existing function.
• Mapping Functions  Applying a function to each element of a list, etc.
• Anonymous Functions  Lambda expressions are functions with no names.
• Generic Functions  Polymorphism, Emacs-style.
• Function Cells  Accessing or setting the function definition of a symbol.
• Closures  Functions that enclose a lexical environment.
• Advising Functions  Adding to the definition of a function.
• Obsolete Functions  Declaring functions obsolete.
• Inline Functions  Functions that the compiler will expand inline.
• Declare Form  Adding additional information about a function.
• Declaring Functions  Telling the compiler that a function is defined.
• Function Safety  Determining whether a function is safe to call.
• Related Topics  Cross-references to specific Lisp primitives that have a special bearing on how functions work.