Books & Videos

Table of Contents

  1. Language Concepts

    1. Chapter 1 A Guided Tour

      1. OCaml as a Calculator
      2. Functions and Type Inference
      3. Tuples, Lists, Options, and Pattern Matching
      4. Records and Variants
      5. Imperative Programming
      6. A Complete Program
      7. Where to Go from Here
    2. Chapter 2 Variables and Functions

      1. Variables
      2. Functions
    3. Chapter 3 Lists and Patterns

      1. List Basics
      2. Using Patterns to Extract Data from a List
      3. Limitations (and Blessings) of Pattern Matching
      4. Using the List Module Effectively
      5. Tail Recursion
      6. Terser and Faster Patterns
    4. Chapter 4 Files, Modules, and Programs

      1. Single-File Programs
      2. Multifile Programs and Modules
      3. Signatures and Abstract Types
      4. Concrete Types in Signatures
      5. Nested Modules
      6. Opening Modules
      7. Including Modules
      8. Common Errors with Modules
      9. Designing with Modules
    5. Chapter 5 Records

      1. Patterns and Exhaustiveness
      2. Field Punning
      3. Reusing Field Names
      4. Functional Updates
      5. Mutable Fields
      6. First-Class Fields
    6. Chapter 6 Variants

      1. Catch-All Cases and Refactoring
      2. Combining Records and Variants
      3. Variants and Recursive Data Structures
      4. Polymorphic Variants
    7. Chapter 7 Error Handling

      1. Error-Aware Return Types
      2. Exceptions
      3. Choosing an Error-Handling Strategy
    8. Chapter 8 Imperative Programming

      1. Example: Imperative Dictionaries
      2. Primitive Mutable Data
      3. for and while Loops
      4. Example: Doubly Linked Lists
      5. Laziness and Other Benign Effects
      6. Input and Output
      7. Order of Evaluation
      8. Side Effects and Weak Polymorphism
      9. Summary
    9. Chapter 9 Functors

      1. A Trivial Example
      2. A Bigger Example: Computing with Intervals
      3. Extending Modules
    10. Chapter 10 First-Class Modules

      1. Working with First-Class Modules
      2. Example: A Query-Handling Framework
      3. Living Without First-Class Modules
    11. Chapter 11 Objects

      1. OCaml Objects
      2. Object Polymorphism
      3. Immutable Objects
      4. When to Use Objects
      5. Subtyping
    12. Chapter 12 Classes

      1. OCaml Classes
      2. Class Parameters and Polymorphism
      3. Object Types as Interfaces
      4. Inheritance
      5. Class Types
      6. Open Recursion
      7. Private Methods
      8. Binary Methods
      9. Virtual Classes and Methods
      10. Initializers
      11. Multiple Inheritance
  2. Tools and Techniques

    1. Chapter 13 Maps and Hash Tables

      1. Maps
      2. Hash Tables
      3. Choosing Between Maps and Hash Tables
    2. Chapter 14 Command-Line Parsing

      1. Basic Command-Line Parsing
      2. Argument Types
      3. Adding Labeled Flags to the Command Line
      4. Grouping Subcommands Together
      5. Advanced Control over Parsing
      6. Command-Line Autocompletion with bash
      7. Alternative Command-Line Parsers
    3. Chapter 15 Handling JSON Data

      1. JSON Basics
      2. Parsing JSON with Yojson
      3. Selecting Values from JSON Structures
      4. Constructing JSON Values
      5. Using Nonstandard JSON Extensions
      6. Automatically Mapping JSON to OCaml Types
    4. Chapter 16 Parsing with OCamllex and Menhir

      1. Lexing and Parsing
      2. Defining a Parser
      3. Defining a Lexer
      4. Bringing It All Together
    5. Chapter 17 Data Serialization with S-Expressions

      1. Basic Usage
      2. The Sexp Format
      3. Preserving Invariants
      4. Getting Good Error Messages
      5. Sexp-Conversion Directives
    6. Chapter 18 Concurrent Programming with Async

      1. Async Basics
      2. Examples: An Echo Server
      3. Example: Searching Definitions with DuckDuckGo
      4. Exception Handling
      5. Timeouts, Cancellation, and Choices
      6. Working with System Threads
  3. The Runtime System

    1. Chapter 19 Foreign Function Interface

      1. Example: A Terminal Interface
      2. Basic Scalar C Types
      3. Pointers and Arrays
      4. Structs and Unions
      5. Passing Functions to C
      6. Learning More About C Bindings
    2. Chapter 20 Memory Representation of Values

      1. OCaml Blocks and Values
      2. Blocks and Values
      3. Tuples, Records, and Arrays
      4. Variants and Lists
      5. Polymorphic Variants
      6. String Values
      7. Custom Heap Blocks
    3. Chapter 21 Understanding the Garbage Collector

      1. Mark and Sweep Garbage Collection
      2. Generational Garbage Collection
      3. The Fast Minor Heap
      4. The Long-Lived Major Heap
      5. Attaching Finalizer Functions to Values
    4. Chapter 22 The Compiler Frontend: Parsing and Type Checking

      1. An Overview of the Toolchain
      2. Parsing Source Code
      3. Preprocessing Source Code
      4. Static Type Checking
      5. The Typed Syntax Tree
    5. Chapter 23 The Compiler Backend: Bytecode and Native code

      1. The Untyped Lambda Form
      2. Generating Portable Bytecode
      3. Compiling Fast Native Code
      4. Summarizing the File Extensions
  1. Colophon