In this course, we’ll learn about Y Combinator through a short story. Let’s first talk about “mathboxes”, one of the key items of this story.
Looking for some other page?
Once upon a time, there was a rural village called “Lambda Village”.
In Lambda Village, a tool called “Mathbox” has been passed down from one generation to next. As its name suggests, a mathbox is a magical tool that can solve math questions. You can think of it as a simple calculator.
Let me explain how it works.
Here’s an example mathbox:
Before I explain what these icons mean, let’s talk about how we can run this mathbox.
Each mathbox has a Run button. If you press it, the mathbox calculates the result. Try pressing Run on the mathbox below.
The result is . That means it calculated .
Let’s look at other mathboxes. Try pressing Run on this one:
The result is , which means it calculated .
Summary: Suppose that you have a mathbox like below:
This is the first feature of mathbox: the “Plus 1” feature . It lets you add to some number.
Mathboxes can also subtract 1 from a number. Try pressing Run below:
The result is . So it calculated .
Summary: If you combine with , it will calculate .
This is the second feature of mathbox: the “Minus 1” feature . It lets you subtract from some number.
Now, here’s a question: Can you think of a way to calculate something like using a mathbox?
Answer: To calculate , use twice on .
Here’s an example. Try pressing Run :
The result is . So it calculated .
You can use both and as many times as you like.
Example: This one uses three times to calculate .
Another example: This one uses four times to calculate .
By using and many times, you can calculate any addition or subtraction, no matter how large the numbers are .
Example: Suppose that you want to calculate . What would the mathbox look like?
Answer: Combine with ten ’s.
Summary: A Mathbox is a magical tool that can calculate additions and subtractions.
Why mathboxes were important: The villagers in Lambda Village were all very bad at math. They even had to rely on mathboxes to calculate simple additions like .
The villagers couldn’t live without mathboxes.
Note: Unfortunately, mathboxes cannot do multiplications or divisions .
It turns out that mathboxes have one more feature other than the “Plus 1” feature and the “Minus 1” feature that we just described.
Let’s talk about this third feature on the next page.