Contents
|
Index
|
Search
Table of Contents
Back Cover
Practical Common Lisp
Typographical Conventions
Chapter 1: Introduction - Why Lisp?
Why Lisp?
Where It Began
Who This Book Is For
Chapter 2: Lather, Rinse, Repeat - A Tour of the REPL
Getting Up and Running with Lisp in a Box
Free Your Mind: Interactive Programming
Experimenting in the REPL
"Hello, World," Lisp Style
Saving Your Work
Chapter 3: Practical - A Simple Database
CDs and Records
Filing CDs
Looking at the Database Contents
Improving the User Interaction
Saving and Loading the Database
Querying the Database
Updating Existing Records - Another Use for WHERE
Removing Duplication and Winning Big
Wrapping Up
Chapter 4: Syntax and Semantics
Breaking Open the Black Box
S-expressions
S-expressions As Lisp Forms
Function Calls
Special Operators
Macros
Truth, Falsehood, and Equality
Formatting Lisp Code
Chapter 5: Functions
Defining New Functions
Function Parameter Lists
Optional Parameters
Rest Parameters
Keyword Parameters
Mixing Different Parameter Types
Function Return Values
Functions As Data, a.k.a. Higher-Order Functions
Anonymous Functions
Chapter 6: Variables
Lexical Variables and Closures
Dynamic, a.k.a. Special, Variables
Constants
Assignment
Generalized Assignment
Other Ways to Modify Places
Chapter 7: Macros - Standard Control Constructs
WHEN and UNLESS
COND
AND, OR, and NOT
Looping
DOLIST and DOTIMES
DO
The Mighty LOOP
Chapter 8: Macros - Defining Your Own
The Story of Mac: A Just-So Story
Macro Expansion Time vs. Runtime
DEFMACRO
Sample Macro: do-primes
Macro Parameters
Generating the Expansion
Plugging the Leaks
Macro-Writing Macros
Beyond Simple Macros
Chapter 9: Practical - Building a Unit Test Framework
Two First Tries
Refactoring
Fixing the Return Value
Better Result Reporting
An Abstraction Emerges
Hierarchy of Tests
Wrapping Up
Chapter 10: Numbers, Characters, and Strings
Numbers
Numeric Literals
Basic Math
Numeric Comparisons
Higher Math
Characters
Character Comparisons
Strings
String Comparisons
Chapter 11: Collections
Vectors
Subtypes of Vector
Vectors As Sequences
Sequence Iterating Functions
Higher-Order Function Variants
Whole Sequence Manipulations
Sorting and Merging
Subsequence Manipulations
Sequence Predicates
Sequence Mapping Functions
Hash Tables
Hash Table Iteration
Chapter 12: They Called It LISP for a Reason - List Processing