> Skip to content
[]
  • Published: 10 November 2026
  • ISBN: 9781718501607
  • Imprint: No Starch
  • Format: Paperback
  • Pages: 648
  • RRP: $125.00

The Algebra of Code, Volume 1

Explore Set Theory, Abstract Algebra, and Category Theory with Functional Programming



This surprisingly accessible book uses key math concepts and more than 500 short exercises to teach functional programming to experienced coders.

Discover the mathematics hiding inside the code you already write.

Functions, types, composition, data structures. You use these ideas in code every day. Look a little closer and something surprising appears: math.

The Algebra of Code teaches functional programming and mathematics together, using F# as a laboratory where you can run abstract ideas and see what they do. You don't need to know F# going in. Part I gets you reading and writing it, and everything you learn carries over to Haskell, OCaml, Scala, and the functional corners of C# and TypeScript.

You'll build numbers and sets from scratch, turn algebraic expressions into data structures, write programs that simplify equations, build Boolean logic, and automate pieces of mathematical reasoning. Along the way, familiar programming concepts reveal deeper connections: algebraic data types follow rules that look remarkably like ordinary algebra, and function composition with strong typing leads toward category theory.

More than 500 short coding exercises have you implement, test, break, and explore every idea yourself. By the time you reach lambda calculus, rings, and categories, they're structures you've already worked with in code.

Volume 1 stands on its own, taking you from functional programming fundamentals through the mathematical ideas that make the deeper connections possible. It is the first of a planned three.

For programmers with solid experience who want to understand math at a deeper level. No proofs or advanced math required.

The math makes you a better programmer. The programming makes the math make sense.

  • Published: 10 November 2026
  • ISBN: 9781718501607
  • Imprint: No Starch
  • Format: Paperback
  • Pages: 648
  • RRP: $125.00