Fun with Lambdas
Fun with Lambdas
Fun with Lambdas

This book is 30% complete

Last updated on 2020-02-25

About the Book

"If you wish to make an apple pie from scratch, you must first create the universe."

- Carl Sagan, Cosmos

This book is about nothing. Or, rather, it is about starting with nothing and creating the world. In our day-to-day lives as programmers, we're used to languages that give us a wide range of nouns, concrete things, to work with, Numbers, String, Arrays, and so forth. And we happily combine them, trying to fit them together in such a way that we come out the other end with a large structure that solves our problem.

What we often forget, though, is that, taken by themselves, these structures are useless. When we talk about combining them, we really mean that we set up interactions between them, hoping that we've defined them correctly. Programming, itself, is about looking at and defining the spaces BETWEEN the nouns. And, yet, we don't spend a lot of time focusing there; when we discuss our programs, we often only mention the things. Take a look at a UML diagram: notice what gets the big boxes and what gets small little arrows connecting them.

In this book, we're going to throw away the nouns and only use the verbs. We're going to start with the most basic of things, the verb, something with an input and an output, and build up our world, our concrete structures. This verb, what we'll be using, is called the Lambda.

I'm planning for this book to be around 100 pages, perhaps stretching as high as 150. It is a short, focused, VERY code-heavy walk-through of building up a numbering system, then a character system, ending with strings. Along the way, we'll discuss the Peano axioms, Addition, Subtraction, Lists, Strings, Key/Value Pairs and end with a Dictionary implementation. 


This is the first (hopefully) book in a series I'm thinking of as "Computer Science for the rest of us." This series is for people who have programming experience, but maybe have some holes in their theoretical knowledge, such as the lambda calculus. These are people who are interested in, and perhaps even started books such as "Function Programming through Lambda Calculus," but found it to be opaque and difficult to get into. They've heard of how cool it is, heard mention of church numerals and Cons/Car/Cdr, but nothing has reached out in a nice narrative way for them.

For this reason, I'm going to be staying away mostly from the more "academic" terms (although I might still have an appendix or two that introduces the ideas, especially how First/Second are really the K combinator and K(Identity)) and just walking through with concrete examples. As with my other book, I'll be pointing to other resources to "find out more" rather than padding the book with explanations.

About the Author

Corey Haines
Corey Haines

I'm Corey Haines. I've been developing software professionally since 1995. I've also spent the past 10 years mentoring and training software developers around the world. I currently work as the CTO/Co-founder of Hearken.

I also love cats!

Authors have earned$8,690,825writing, publishing and selling on Leanpub,
earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub