Programming, lame meme 

Me (who is not a programmer) trying to fully wrap my brain around recursive functions in Pascal tonight.

Programming, lame meme 

My professor in college said the most important part of recursion is understanding the base case

re: Programming, lame meme 

@paulgatling Once I looked at a few more explanations and examples (including in other languages) it started making sense.

At least until I started in Fibonacci, then it felt like starting all over again. Eventually by writing everything out by hand I was able to figure out how that was working too!

And then I dreamed about Fibonacci and recursion all night... 😆​

re: Programming, lame meme 

LOL that's some of my best problem solving time!

@efftoyz @devrandom It's honestly quite simple to understand when properly explained.

Or with trivial Scheme loops.

(let loop ((l '(4 3 2 1)))
(if (not (null? l))
(display (car l))
(loop (cdr l)))))

Pascal just makes it harder because it doesn't mandate proper compilers (with TCO) afaik.

@lispi314 @efftoyz by looking up more explanations and examples in a few different languages I've played around with before I was finally able to wrap my brain around the concept. Or at least I think I mostly get it.

I probably should spend time playing around with it more so that I really understand it and don't forget it.

It's strange, I've done tons of beginner programming books and tutorials in lots of languages. Recursive functions like this are rarely explained.

@devrandom @efftoyz That's mostly because recursion is at-best seen as a second-tier citizen in those languages, if not outright considered an anti-pattern.

Because it's easier to dislike useful abstractions like recursion than to mandate you can't take the lazy way out by writing your compiler with no support for them.

It enforces exactly the kind of verbosity or explicit stack management compilers are supposed to take care of for you with clean semantics.

@efftoyz in my extremely limited experience so far, that is very apt!

re: Programming, lame meme 

@cy thank you I really appreciate all of this explanation! I’ve saved it to my notes now.

Sign in to participate in the conversation

A bunch of technomancers in the fediverse. This arcology is for all who wash up upon it's digital shore.