Frivolous Gravitas Extras - Live Session #1: Primitive Recursion in Javascript (start to finish)

Опубликовано: 25 Май 2026
на канале: Frivolous Gravitas
108
6

Today you’re going to learn all about primitive recursion. It’s not every day that you learn a life-changing skill but we’re going to make today is one of those days.

We’re going to bend your mind a bit. We’re going to cover primitive recursion in javascript but this is not a programming tutorial. I’m going to start from the ground up so no experience is required at all. Playing with recursion and programming helps by giving your brain some practise in breaking larger problems down into smaller, reusable, more manageable parts and components. Deconstruction, in other words, is the name of the game here.

To do this, we’re going to write a script that just multiplies numbers – but we’re going to do it strictly by using addition.

Even if you have no experience programming you can do it for the first time in your life right now while you’re watching this video. If you don’t feel up to mucking about on the computer right now, that’s fine too, you can still benefit greatly from watching me muddle through it since I’ll be stepping through every line of code I write to demonstrate the logical process involved in recursive programming anyway. It’s the thought process, (or in other words: the paradigm) that’s our focus today, not the programming language, persay.

In just this one video you’re going to see primitive recursion in action, scripted from the ground up so you can get intimately acquainted with the concept of functions that call themselves recursively to arrive at a solution to a problem. We’ll start by writing some simple functions so you can see what regular functions do and how they’re used, and then we’ll reuse those simple functions to build a more complicated recursive function on top of them. The main objective of this project is just to write a function that multiplies any numbers we give the function when we call it.

We’re not here just to teach some useful scripting skills, it’s mostly to help everyone learn to think about problem solving in a completely new way. In programming there are always many ways of doing the same thing or tackling the same problems. Most of the time you’ll want to use built-in functions to more quickly and legibly get what you want done, but if you approach writing code as a kind of puzzle you can challenge yourself to do things in a way that forces your brain to sort of build your solution in a new way. That’s the part of writing code that strongly encourages you to think in a new way, rather than using what you already know. It’s also a good approach to do this and force yourself to use a newly learned tool, as another example, to practise looking at the documentation or tutorials for the programming language that you’re using.

This is like solving a problem with primitive recursion. I’m not suggesting this is the best approach to fixing problems in all cases, what I’m suggesting is that if you’re ever stuck on a hard problem and don’t know how to start. When you structure the solution to common problems using recursion, you’re applying the mental load at the start of the process so you can forget the complications and details forever after while still arriving at the intended target. You always wind up with the right answer and you never have to second guess the variable factors as time goes by.

Recursion and recursive problem solving is a path toward life goals and significant achievement. Successful people share similar routines and habits, whether they realize it or not. Approaching problems with the mentality of primitive recursion is a way of deconstructing complexity to make it easier to steer your actions and energies toward a productive outcome. It’s not about finishing or the final calculation that defines success, it’s the routine of constantly inching closer to where you want to end up in a whole variety of directions at the same time because you need only focus on the steps in front of you every day, the long term desired result is inevitable once you’ve got the next step figured out. Thinking about long term goals on a constant basis is exhausting because of all the steps and variables along the way that need to be considered, but by focusing on what’s directly in front of you with the trust that you can safely ignore all the minutia of details in between the start and finish line leaves you able to tackle several long-term goals all at the same time without being overloaded by the steps of all of those targets individually.

#FrivolousGravitas Links:
Channel:    / @frivolousgravitas  
FB:   / frivolous-gravitas-podcast-109356198202987  
Twitter:   / frivolousgravi1  
GitHub File Download: https://github.com/paxdriver/html-tools/

If you like this kind of content and want to see more, be sure to like, share and subscribe to help keep this channel going.

RSS Feed: https://www.krisdriver.com/feed/rssfe...

Original Music by Epistra