Currying, Lambda Calculus, and What Computation Is — A Detour with 🧙♂️ and 🐣
A professor and a student follow a question about curried functions into isomorphism, closures, Church numerals, information theory, and minimal models of computation.
Currying can seem clear until you switch back to the code and things turn hazy again.
The question still sitting on your desk is “How much of this do I actually need at work?”
A professor and a student take that question seriously and follow it wherever it leads.
A long conversation between a professor and a student
It started with “What is a curried function?”
Before long, we had wandered into what computation is.
There are a few detours. They belong here too.
The participants
🧙♂️ (Professor) tends to go on once the theory comes up. His analogies can veer off without warning.
🐣 (Student) has an eye on practical work and challenges any explanation that doesn’t make sense yet.
Do add(2,3) and add(2)(3) look alike?
🐣 (Student) “Professor, I saw this code in an explanation of currying. These are plainly two different things, right?”
function add(a, b) {
return a + b;
}
function curriedAdd(a) {
return function (b) {
return a + b;
};
}
🧙♂️ (Professor) “Good. That’s exactly the right thing to notice first. They’re distinct functions. They’re equivalent in the sense that they can produce the same result.”
add(2, 3); // 5
curriedAdd(2)(3); // 5
🐣 (Student) “Different forms, same answer. So they’re equivalent in behavior.”
🧙♂️ (Professor) “Exactly. Here’s what that looks like in notation.”
(a, b) → c
becomes
a → (b → c)
That rearrangement is the heart of currying.
📌 Note on equivalence and identity\
- Identity means the objects are literally the same.\
- Equivalence means the properties under observation agree, in this case the input–output behavior.
Mixing those two ideas can quickly make currying hard to follow.
Is curriedAdd(2) an intermediate value or a new function?
🐣 (Student) “Then is curriedAdd(2) just an incomplete value halfway through the calculation?”
🧙♂️ (Professor) “It’s a new function in its own right.”
const add2 = curriedAdd(2);
add2(10); // 12
It behaves like this.
b => 2 + b
🐣 (Student) “I see. It makes a function that adds two.”
🧙♂️ (Professor) “Think of it as adding a wrench to your toolbox made just for adding two.”
🐣 (Student) “That analogy went straight to the hardware store, Professor.”
🧙♂️ (Professor) “Math has to get its hands dirty to be worth anything. Probably.”
Closures give functions more than code
🧙♂️ (Professor) “A closure is what lets add2 work. It remembers a = 2.”
Here’s a sketch.
Function
├ Code
└ Environment (variables)
🐣 (Student) “So the function runs with its code and the state it captures.”
🧙♂️ (Professor) “That’s a good way to understand it. Once that clicks, curried functions tend to feel a lot less alien.”
Wouldn’t an ordinary function do?
🐣 (Student) “At work this would do just fine, wouldn’t it?”
const url = "...";
fetchUser(url, id);
“I don’t see much reason to write fetchUser(url)(id).”
🧙♂️ (Professor) “That intuition is sound in information systems development. Currying is generally a choice of style. What can be expressed stays the same.”
🐣 (Student) “That’s a relief. I don’t lose points for skipping it.”
🧙♂️ (Professor) “Of course. Let the job determine which tool you use.”
How much does currying matter in practice?
Here’s a rough sense of how it varies by field.
| Field | Importance |
|---|---|
| Information systems | Low |
| Web development | Low to moderate |
| Scientific computing | Low |
| Functional languages | High |
| Theory of computation | Very high |
🐣 (Student) “So I can get by in information systems without it.”
🧙♂️ (Professor) “Yes. But the theory makes it easier to explain why you want an API to have a particular shape.”
📌 Where currying can help at work\
- Fixing configuration in advance and passing the resulting function onward (partial application).\
- Composing functions into a pipeline to make the flow of data easier to follow.\
- Creating a function with fixed dependencies to isolate behavior for testing.
If the team would find the result harder to read, it’s fine to skip it.
What does “every function takes one argument” mean?
🧙♂️ (Professor) “There’s a well-known line that comes up here.”
Every function can be represented using single-argument functions
🐣 (Student) “It sounds like a big claim, but it feels a long way from writing code.”
🧙♂️ (Professor) “That’s natural. The claim is about what the representation can express.”
f(a, b)
≡
f(a)(b)
(a, b) → c
≡
a → (b → c)
🧙♂️ (Professor) “The important point is the isomorphism between the two forms. Use whatever form makes sense in your code.”
🐣 (Student) “I wish textbooks would put that in bold on page one.”
Sound waves alone won’t teach you a language
🐣 (Student) “Being told that speech consists of sound waves won’t make me better at conversation. Vowels, consonants, and grammar actually help me learn.”
🧙♂️ (Professor) “Good analogy. Single-argument functions in lambda calculus show how little you need for computation to be possible.”
🐣 (Student) “I see. Strip it down, then show that you can still compute.”
🧙♂️ (Professor) “Exactly.”
Lambda calculus reduces computation to a few building blocks
🐣 (Student) “So far we’ve seen that f(a, b) and f(a)(b) are equivalent. Now we need a foundation that can explain the equivalence.”
🧙♂️ (Professor) “Right. We’re moving up a level, from a coding technique to a theoretical model that asks how to define computation itself. Lambda calculus is a minimal model for that purpose. It asks whether variables, abstraction (λx.expression), and application suffice to describe computation. From there, we can explain the relationship between f(a, b) and f(a)(b) in terms of the structure of computation.”
Lambda calculus asks
What is computation?
and seeks to define it using very little. It has three building blocks.
Variables
λx.expression
Function application
Computation is defined as
Rewriting expressions
🐣 (Student) “So you think in terms of applying rewrite rules.”
🧙♂️ (Professor) “Yes. The CPU drops out of the picture and the rules remain.”
There are no built-in numbers, if statements, or loops
Lambda calculus starts without
Numbers
if
Loops
but it can express them. Church numerals, for example, look like this.
0 = λf.λx.x
1 = λf.λx.f x
2 = λf.λx.f (f x)
🐣 (Student) “That doesn’t look like a two. It looks like a spell.”
🧙♂️ (Professor) “2 is a curried function that applies f twice. The familiar numeral is gone, but the behavior of two is still there.”
🐣 (Student) “So you define numbers by what they mean here.”
🧙♂️ (Professor) “By what they do. Theory has a habit of doing that, and it’s part of the appeal.”
📌 Why use such a roundabout expression?
It shows that you can keep the power to compute with a minimal set of tools.
That perspective leads to questions about computability, termination, and expressive power.
Information theory minimizes something else
🐣 (Student) “If we’re trying to make things minimal, wouldn’t it be simpler to use zeros and ones?”
🧙♂️ (Professor) “That’s a question about information.”
Smallest unit of information = bit
The model of computation we’re discussing looks at
Basic operation of computation = rewriting
In other words,
Information
and
computation
raise different questions
🐣 (Student) “The same word ‘minimal’ comes up, but we’re measuring two different things.”
🧙♂️ (Professor) “Yes. Mix them up and it’s easy to get lost.”
A minimal model shows where the boundary lies
🐣 (Student) “Honestly, the further we go, the further this feels from my day job.”
🧙♂️ (Professor) “That’s a natural reaction. A minimal model shows how far you can pare things back and still make them work.”
A demonstration
of where
the boundary lies
🐣 (Student) “It shows how much you can strip away.”
🧙♂️ (Professor) “Right. Theory often draws the map before implementation begins.”
Like philosophy, it asks for the minimum conditions
🐣 (Student) “Sounds a little like philosophy. ‘I think, therefore I am.’”
🧙♂️ (Professor) “There’s a resemblance. Both ask what the minimum conditions are.”
Cogito
→ Minimum condition for existence
Lambda calculus
→ Minimum conditions for computation
🐣 (Student) “Fair enough. It won’t build the product on its own.”
🧙♂️ (Professor) “But it can turn out to be central to the design later.”
Conclusion
Currying can be a
Useful technique
and it is also a
Structure that appears when computation is stripped down
For practical work, these three points are enough.
- Use readable multi-argument functions in everyday code.\
- Reach for currying when it helps with function composition or partial application.\
- Keep the theory in mind when making longer-term decisions about design.
🐣 (Student) “So it won’t close today’s ticket, but it could help with a design decision later.”
🧙♂️ (Professor) “That’s a practical way of looking at it. Theory takes a while to work, but the benefits build over time. A bit like Kampo, the traditional Japanese practice of herbal medicine.”
🐣 (Student) “We’re ending on herbal medicine now?”
🧙♂️ (Professor) “Why not? If it works, it works.”