A Complete Guide to the Language and Its Philosophy
Introduction: Why Learn Scheme?
- The Promise of This Book
- A Note on Standards and Portability
- How to Read This Book
- What Scheme Is Not
Chapter 1: What Is Scheme?
- The Lisp Family Tree: From McCarthy to Today
- The Birth of Scheme: MIT AI Lab and Minimalist Design
- The Standardization Story: R5RS Through R7RS
- What Makes Scheme Different: A Philosophy of Simplicity
- Choosing an Implementation: Getting Started with Real Code
Chapter 2: First Steps in Scheme
- The Read-Eval-Print Loop: Your First Encounter
- Expressions and Values: Everything Evaluates to Something
- Numbers and Arithmetic: More Than Just Math
- Quoting: When You Want Data Instead of Computation
- Lists as the Fundamental Structure
- Putting It Together: Your First Real Program
Chapter 3: Procedures and Functions
- Defining Procedures with
define - Calling Procedures: Application and Argument Passing
- Lambda: The Anonymous Function at the Core
- First-Class Functions: Functions as Data
- Named vs Anonymous: When Each Makes Sense
- Quasiquoting and Unquoting
- Summary
Chapter 4: Control Flow and Conditionals
- Boolean Values and Predicates
if: The Fundamental Conditionalcondandcase: Multi-Way Branching- Recursion as the Primary Loop Mechanism
- Mutual Recursion: Functions Calling Each Other
- Summary
Chapter 5: Data Structures
- Pairs and Cons Cells: The Atomic Building Block
- Lists: Construction, Traversal, and Patterns
- Symbols: Named Atoms for Programs and Data
- Strings and Characters: Text Processing
- Vectors: Indexed Collections for Performance
- Summary
Chapter 6: State and Mutation
- Variables as Names for Values
- Lexical Scope: Where Bindings Live
set!: Changing Variable Values- Mutable Data Structures:
set-car!,set-cdr!, and Friends - When to Mutate and When Not To
- Summary
Chapter 7: Higher-Order Programming
- Functions That Take Functions as Arguments
- Map, Filter, Fold: The Functional Toolkit
- Function Composition and Partial Application
- Closures: Capturing Environment
- Building Domain-Specific Abstractions
- Summary
Chapter 8: Tail Calls and Efficiency
- What Is a Tail Call?
- Tail-Recursive Patterns for Iteration
- How Tail-Call Optimization Works
- Accumulators and State in Pure Function Style
- Performance Implications and Real-World Use
- Summary
Chapter 9: Input, Output, and Exceptions
- Reading from and Writing to Ports
- File I/O: Opening, Reading, Writing, Closing
- Standard Input and Output
- Exception Handling with
with-exception-handler - Error Reporting and Debugging Techniques
- Summary
Chapter 10: Records and Structured Data
- The Need for Structured Data
- R6RS/R7RS Record Types
- Accessors, Mutators, Predicates
- Extending and Inheriting Record Types
- Practical Data Modeling with Records
- Summary
Chapter 11: Macros and Metaprogramming
- Why Macros Exist: Beyond Functions
syntax-rules: Pattern-Matching Code Generation- Hygienic Macros: Avoiding Name Collisions
- Writing Useful Macros: Let Variants and More
- When Macros Help and When They Hurt
- Summary
Chapter 12: Continuations and Control Flow
- What Is a Continuation?
call-with-current-continuation: Capturing Control- Nonlocal Exits and Exception Handling
- Coroutines and Generators with Continuations
- Backtracking and Search Algorithms
- Summary
Chapter 13: Delayed Evaluation and Streams
- Eager vs Lazy Evaluation
- Promises with
delayandforce - Infinite Sequences as Finite Objects
- Stream Operations: Map, Filter, Fold on Streams
- Practical Uses of Lazy Evaluation
- Summary
Chapter 14: Modules and Libraries
- The Module Problem: Why Namespaces Matter
- R5RS Style: No Built-In Modules
- R6RS and R7RS Module Systems
- Importing, Exporting, Renaming
- Building Library Code for Others to Use
- Summary
Chapter 15: Interpreters and DSLs
- Why Scheme Is Great for Language Work
- Writing a Metacircular Evaluator
- Extending the Language with New Forms
- Building Domain-Specific Languages
- From Interpreter to Compiler: The Path Forward
- Summary
Chapter 16: Performance, Testing, and Real-World Development
- Understanding Scheme Performance Characteristics
- Profiling and Optimizing Code
- Testing Strategies for Scheme Programs
- Debugging Techniques Across Implementations
- Interoperability: Calling C, FFI, Foreign Languages
- Concurrency Where Available
- Summary
Chapter 17: The Scheme Ecosystem Today
- Major Implementations Compared
- Libraries and Package Managers by Implementation
- Real-World Uses of Scheme Today
- The Future of Scheme: Trends and Directions
- Where to Go From Here