2 ms·
I've been doing functional programming so long that I genuinely have a hard time thinking about how I would write things without recursion. Like, I technically
by tombert 3y ago
I've been doing functional programming so long that I genuinely have a hard time thinking about how I would write things without recursion.
Like, I technically know how to convert a recursive algorithm to an iterative one, I've done it before on more resource-constrained stuff, but I don't like it. I think the recursive stuff is generally prettier and for 99% of things it's fast enough (and 100% if your compiler supports tail recursion, though you'd still be stuck maintaining a stack for most of the more interesting stuff).
Occasionally I'll do things to force myself to learn how things were done before I was born. I've been on/off hacking on a Commodore 64 game, but man I feel pretty grateful to be as spoiled as I am with fast, cheap, easy-to-use hardware.
- wglb 3y agoYes, instruction sets these days are significantly more useful. To do recursion in those old machines, one would need to build your own stack mechanism, but there would still be issues to take care of, as there was no native way to use anything but global storage. Having lived through those times, I don't wish them on anyone.
- deleted 3y ago[deleted]