Recurser is a project that aims to make understanding recursion easier.

Many tutorials do a great job of showing static diagrams that walk you through the steps of something like the Fibonacci sequence. Because others have covered the topic so well already, I wanted to find a new angle from which to explain the concept.

I built Recurser so that people can experiment with recursion in an interactive fashion.

It’s a pretty straightforward app: There’s a text box for entering your recursive function, and an output area that draws the resulting tree. Each recursive call is displayed with arguments and return values. The speed slider allows you to study its progression, or to race through to the end result.

The functions are written in a minimal C-like language.

fun(n) {
    if (n <= 1) {
        return n;
    }
    return fun(n - 1) + fun(n - 2);
}

fun(6);

There are some great resources out there if you’d like to have a more formal introduction to recursion.