Let's informally define the meanings of each of the described commands:
1. \\(\\text{Pop} \\; n\\): Removes the top \\(n\\) elements from the stack.
2. \\(\\text{Slide} \\; n \\): Removes the top \\(n\\) elements __after the first element on the stack__.
The first element is not removed.
2. \\(\\text{Offset} \\; n \\): Pushes an element from the stack onto the stack, again. When \\(n=0\\),
the top element is pushed, when \\(n=1\\), the second element is pushed, and so on.
3. \\(\\text{Eq}\\): Compares two numbers on top of the stack for equality. The numbers are removed,
and replaced with a boolean indicating whether or not they are equal.
4. \\(\\text{PushI} \\; i \\): Pushes an integer \\(i\\) onto the stack.
5. \\(\\text{Add}\\): Adds two numbers on top of the stack. The two numbers are removed,
and replaced with their sum.
6. \\(\\text{Mul}\\): Multiplies two numbers on top of the stack. The two numbers are removed,
and replaced with their product.
7. \\(\\textbf{if}\\)/\\(\\textbf{else}\\): Runs the first list of commands if the boolean "true" is
on top of the stack, and the second list of commands if the boolean is "false".
8. \\(\\textbf{func}\\): pushes a function with the given commands onto the stack.
9. \\(\\text{Call}\\): calls the function at the top of the stack. The function is removed,
and its body is then executed.
Great! Let's now write some dummy programs in our language (and switch to code blocks
from LaTeX). How about a program that multiplies 4 and 5?
```
PushI 5
PushI 4
Mul
```
Next, let's try something more complicated.
{{< sidenote "right" "contrived-note" "How about a program that checks if 3 is equal to 4, and returns 999 if they are equal, and 1 if they are not?" >}}
I'm aware that this example is contrived. To minimize the cognitive load of working with our language, I've stripped it of many useful features, including
inequalities. This is why the example may seem strange: I had to pose a question I could answer!
{{< /sidenote >}}
```
PushI 4
PushI 3
Eq
if { PushI 999 } else { PushI 1 }
```
Now, it's time for the actual meat: can our language do recursion?
I claim that it does, but before we start hacking away, there's one more thing we need to do:
establish a calling convention.
### Be Conventional!
Our language does not enforce any etiquette. You can easily create a function
that pops every value off the stack, continuing until the stack is empty.
You can equally easily make a function that fills your stack with random junk.
With such potential for disorder, a programmer --- maybe yourself --- may experience some
{{< sidenote "right" "anomie-note" "anomie." >}}
Anomie is defined as "lack of the usual social or ethical standards in an individual or group" according
to the Oxford dictionary.
{{< /sidenote >}} To deal with this, we try to maintain a little bit of order in the midst
of all the computational chaos. We will adopt calling conventions.
When I say calling convention, I mean that every time we call a function, we do it in a
methodical way. There are many possible such methods, but I propose the following:
1. Since \\(\\text{Call}\\) requires that the function you're calling is at the top
of the stack, we stick with that.
2. If the function expects arguments, we push them on the stack right before the function. The
first argument of the function should be second from the top of the stack (i.e.,
{{< sidenote "right" "offset-note" "accessible from the function via \(\text{Offset} \; 0\))." >}}
Note that \(\text{Call}\) removes the function from the stack, which is why the first argument
ends up at the very top.
{{< /sidenote >}} The second argument should follow, then the third, and so on.
3. When a function returns, it should not leave its arguments on the stack. Instead of them,
the function should leave its resulting value.
4. A function does not modify the stack below the arguments it receives.
Let's try this out with a basic function definition and call. How about a function that
always returns 0, no matter what argument you give it? The function itself
would look something like this:
```
PushI 0
Slide 1
```
Here's how things will play out. When the function is called --- and we assume
that it is called correctly, of course -- it will receive an integer
on top of the stack. That may not, and likely will not, be the only thing on the stack.
However, to stick by convention 4, we pretend that the stack is empty, and that
trying to manipulate it will result in an error. So, we can start by imagining