Programming, lame meme 

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

@devrandom, as they say "to understand recursion, first, you have to understand recursion".

Suivre

@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))
(begin
(display (car l))
(newline)
(loop (cdr l)))))

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

· · Web · 1 · 0 · 1

@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.

Inscrivez-vous pour prendre part à la conversation
Mastodon.top

Mastodon.top est une instance stable, régulièrement mise à jour et accessible à tous hébergée par VirtuBox