Your Esoteric Benefactor:

The Simple Richness of Lambda Calculus

Why Lambda Calculus?

Simplicity & Composibility

vs

Syntactic sugar that is not...

Kill accidental complexity

Grokking FP

The Grammar

<expr> ::= <name> | <func> | <appl>

<name> is an identifier (sorry, no BNF)

<func> ::= λ<name>.<body>

<body> ::= <expr>

<appl> ::= (<func> <expr>)

In More Familiar Syntax

λx.x
x => x
function(x) { return x; }
lambda x: x
\x -> x
fun x -> x
(fn [x] x)
(lambda (x) x)

Less options, more power

Exactly one input

Exactly one output

Pure Expressions

λx.x

λx.x

Currying & Partial Application

((λx.λy.λz.x (y z)) a) b

(λy.λz.a (y z)) b

λz.a (b z)

Recognize these functions?

λx.x

λf.λa.(f a)

λx.λy.x

λf.λx.λy.((f y) x)

identity

apply

const

flip

Data Structures

fst := λx.λy.x

snd: = λx.λy.y

pair := λx.λy.λf.((f x) y)

Boolean Logic

true := λx.λy.x

false := λx.λy.y

if := λx.λy.λf.((f x) y)

Church Encoding

zero := λf.λx.x

succ := λn.λf.λx.(f ((n f) x))

one := λf.λx.(f x)

two := λf.λx.(f (f x))

Unsigned Arithmetic

plus :=
    λm.λn.λf.λx.(m (f ((n f) x)))

mult := λm.λn.λf.(m (n f))

exp := λm.λn.(n m)

Function Compotion

λfλgλx.(f (g x))

Have I Piqued Your Curiosity?

The Lambda is Your Benefactor

Your Esoteric Benefactor: The Simple Richness of Lambda Calculus

By Keith Pinson

Your Esoteric Benefactor: The Simple Richness of Lambda Calculus

It's easy to think that lambda calculus is not much more than a bizarre, impractical form of abstract math, but it is absolutely foundational to programming, not only providing a theoretical basis but also a rich set of simple, practical abstractions. Good abstractions are hard to come by; there seems to be an inverse relationship between simplicity and ease, so the plain but powerful lambda is an indispensable tool to the programmer.

  • 1,195