A free, self-paced textbook in 8 chapters. Read a chapter, then drill it with the 170 companion flashcards using spaced repetition.
Functional programming is a declarative paradigm that treats computation as the evaluation of mathematical functions. Rather than describing step-by-step procedures that mutate sta...
Functional programming treats functions as first-class values: they can be assigned to variables, passed as arguments, returned from other functions, and stored in data structures....
Functional programming favors immutable data structures that, when modified, produce new versions while preserving the old. Persistent data structures achieve this efficiently thro...
Since loops rely on mutable state, functional programming replaces them with recursion, in which a function calls itself on smaller subproblems until it reaches a base case. Deep r...
The functor–applicative–monad hierarchy is a layered abstraction for sequencing computations on wrapped values. A functor is any type that implements a map operation, letting you a...
Haskell's type classes provide a mechanism for ad-hoc polymorphism, defining behavior that works across many types. Common examples include \( \text{Eq} \) for equality comparison,...
Lambda calculus, invented by Alonzo Church in the 1930s, is the theoretical foundation of functional programming. It has only three constructs: variables, abstraction \( \lambda x....
Different functional languages emphasize different aspects of the paradigm. Haskell is pure and lazy by default, with monadic IO and a powerful type system. OCaml is strict by defa...