Preface 1. The Extensible Language 1.1 Design by Evolution 1.2 Programming Bottom-Up 1.3 Extensible Software 1.4 Extending Lisp 1.5 Why Lisp (or When) 2. Functions 2.1 Functions as Data 2.2 Defining Functions 2.3 Functional Arguments 2.4 Functions as Properties 2.5 Scope 2.6 Closures 2.7 Local Functions 2.8 Tail-Recursion 2.9 Compilation 2.10 Functions from Lists 3. Functional Programming 3.1 Functional Design 3.2 Imperative Outside-In 3.3 Functional Interfaces 3.4 Interactive Programming 4. Utility Functions 4.1 Birth of a Utility 4.2 Invest in Abstraction 4.3 Operations on Lists 4.4 Search 4.5 Mapping 4.6 I/O 4.7 Symbols and Strings 4.8 Density 5. Returning Functions 5.1 Common Lisp Evolves 5.2 Orthogonality 5.3 Memoizing 5.4 Composing Functions 5.5 Recursion on Cdrs 5.6 Recursion on Subtrees 5.7 When to Build Functions 6. Functions as Representation 6.1 Networks 6.2 Compiling Networks 6.3 Looking Forward 7. Macros 7.1 How Macros Work 7.2 Backquote 7.3 Defining Simple Macros 7.4 Testing Macroexpansion 7.5 Destructuring in Parameter Lists 7.6 A Model of Macros 7.7 Macros as Programs 7.8 Macro Style 7.9 Dependence on Macros 7.10 Macros from Functions 7.11 Symbol Macros 8. When to Use Macros 8.1 When Nothing Else Will Do 8.2 Macro or Function? 8.3 Applications for Macros 9. Variable Capture 9.1 Macro Argument Capture 9.2 Free Symbol Capture 9.3 When Capture Occurs 9.4 Avoiding Capture with Better Names 9.5 Avoiding Capture by Prior Evaluation 9.6 Avoiding Capture with Gensyms 9.7 Avoiding Capture with Packages 9.8 Capture in Other Name-Spaces 9.9 Why Bother? 10. Other Macro Pitfalls 10.1 Number of Evaluations 10.2 Order of Evaluation 10.3 Non-functional Expanders 10.4 Recursion 11. Classic Macros 11.1 Creating Context 11.2 The with- Macro 11.3 Conditional Evaluation 11.4 Iteration 11.5 Iteration with Multiple Values 11.6 Need for Macros 12. Generalized Variables 12.1 The Concept 12.2 The Multiple Evaluation Problem 12.3 New Utilities 12.4 More Complex Utilities 12.5 Defining Inversions 13. Computation at Compile-Time 13.1 New Utilities 13.2 Bezier Curves Example 13.3 Applications 14. Anaphoric Macros 14.1 Anaphoric Variants 14.2 Failure 14.3 Referential Transparency 15. Macros Returning Functions 15.1 Building Functions 15.2 Recursion on Cdrs 15.3 Recursion on Subtrees 15.4 Lazy Evaluation 16. Macro-Defining Macros 16.1 Abbreviations 16.2 Properties 16.3 Anaphoric Macros 17. Read-Macros 17.1 Macro Characters 17.2 Dispatching Macro Characters 17.3 Delimiters 17.4 When What Happens 18. Destructuring 18.1 Destructuring on Lists 18.2 Other Structures 19. A Query Compiler 19.1 The Database 19.2 Pattern-Matching Queries 19.3 A Query Interpreter 19.4 Restrictions on Binding 19.5 A Query Compiler 20. Continuations 20.1 Scheme Continuations 20.2 Continuation-Passing Macros 20.3 Code-Walkers and CPS Conversion 21. Multiple Processes 21.1 The Process Abstraction 21.2 Implementation 21.3 The Less-than-Rapid Prototype 22. Nondeterminism 22.1 The Concept 22.2 Search 22.3 Scheme Implementation 22.4 Common Lisp Implementation 22.5 Cuts 22.6 True Nondeterminism 23. Parsing with ATNs 23.1 Background 23.2 The Formalism 23.3 Nondeterminism 23.4 An ATN Compiler 23.5 A Sample ATN 24. Prolog 24.1 Concepts 24.2 An Interpreter 24.3 Rules 24.4 The Need for Nondeterminism 24.5 New Implementation 24.6 Adding Prolog Features 24.7 Examples 24.8 The Senses of Compile 25. Object-Oriented Lisp 25.1 Plus ca Change 25.2 Objects in Plain Lisp 25.3 Classes and Instances 25.4 Methods 25.5 Auxiliary Methods and Combination 25.6 CLOS and Lisp 25.7 When to Object A. Packages B. Notes Index of Figures Index of Functions Concept Index
1.1 Design by Evolution 1.2 Programming Bottom-Up 1.3 Extensible Software 1.4 Extending Lisp 1.5 Why Lisp (or When)
2.1 Functions as Data 2.2 Defining Functions 2.3 Functional Arguments 2.4 Functions as Properties 2.5 Scope 2.6 Closures 2.7 Local Functions 2.8 Tail-Recursion 2.9 Compilation 2.10 Functions from Lists
3.1 Functional Design 3.2 Imperative Outside-In 3.3 Functional Interfaces 3.4 Interactive Programming
4.1 Birth of a Utility 4.2 Invest in Abstraction 4.3 Operations on Lists 4.4 Search 4.5 Mapping 4.6 I/O 4.7 Symbols and Strings 4.8 Density
5.1 Common Lisp Evolves 5.2 Orthogonality 5.3 Memoizing 5.4 Composing Functions 5.5 Recursion on Cdrs 5.6 Recursion on Subtrees 5.7 When to Build Functions
6.1 Networks 6.2 Compiling Networks 6.3 Looking Forward
7.1 How Macros Work 7.2 Backquote 7.3 Defining Simple Macros 7.4 Testing Macroexpansion 7.5 Destructuring in Parameter Lists 7.6 A Model of Macros 7.7 Macros as Programs 7.8 Macro Style 7.9 Dependence on Macros 7.10 Macros from Functions 7.11 Symbol Macros
8.1 When Nothing Else Will Do 8.2 Macro or Function? 8.3 Applications for Macros
9.1 Macro Argument Capture 9.2 Free Symbol Capture 9.3 When Capture Occurs 9.4 Avoiding Capture with Better Names 9.5 Avoiding Capture by Prior Evaluation 9.6 Avoiding Capture with Gensyms 9.7 Avoiding Capture with Packages 9.8 Capture in Other Name-Spaces 9.9 Why Bother?
10.1 Number of Evaluations 10.2 Order of Evaluation 10.3 Non-functional Expanders 10.4 Recursion
11.1 Creating Context 11.2 The with- Macro 11.3 Conditional Evaluation 11.4 Iteration 11.5 Iteration with Multiple Values 11.6 Need for Macros
12.1 The Concept 12.2 The Multiple Evaluation Problem 12.3 New Utilities 12.4 More Complex Utilities 12.5 Defining Inversions
13.1 New Utilities 13.2 Bezier Curves Example 13.3 Applications
14.1 Anaphoric Variants 14.2 Failure 14.3 Referential Transparency
15.1 Building Functions 15.2 Recursion on Cdrs 15.3 Recursion on Subtrees 15.4 Lazy Evaluation
16.1 Abbreviations 16.2 Properties 16.3 Anaphoric Macros
17.1 Macro Characters 17.2 Dispatching Macro Characters 17.3 Delimiters 17.4 When What Happens
18.1 Destructuring on Lists 18.2 Other Structures
19.1 The Database 19.2 Pattern-Matching Queries 19.3 A Query Interpreter 19.4 Restrictions on Binding 19.5 A Query Compiler
20.1 Scheme Continuations 20.2 Continuation-Passing Macros 20.3 Code-Walkers and CPS Conversion
21.1 The Process Abstraction 21.2 Implementation 21.3 The Less-than-Rapid Prototype
22.1 The Concept 22.2 Search 22.3 Scheme Implementation 22.4 Common Lisp Implementation 22.5 Cuts 22.6 True Nondeterminism
23.1 Background 23.2 The Formalism 23.3 Nondeterminism 23.4 An ATN Compiler 23.5 A Sample ATN
24.1 Concepts 24.2 An Interpreter 24.3 Rules 24.4 The Need for Nondeterminism 24.5 New Implementation 24.6 Adding Prolog Features 24.7 Examples 24.8 The Senses of Compile
25.1 Plus ca Change 25.2 Objects in Plain Lisp 25.3 Classes and Instances 25.4 Methods 25.5 Auxiliary Methods and Combination 25.6 CLOS and Lisp 25.7 When to Object