this post was submitted on 21 Jul 2023
839 points (97.4% liked)

Programmer Humor

19512 readers
380 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 1 year ago* (last edited 1 year ago) (1 children)

Nope recursion would be a bigger cable connected to same cable only smaller, connected to the same cable only smaller, etc..

If this is how your recursion looks like you have a problem and you need to rethink your recursion step and and stop condition :)

[–] [email protected] 3 points 1 year ago (2 children)

I disagree. Recursion is the same thing over and over again until the exit condition. Nothing is getting smaller except the remaining entries.

[–] [email protected] 3 points 1 year ago (1 children)

That's just "recurrence." The same as a "while" loop. Recursion is specifically when a procedure invokes itself.

[–] [email protected] 2 points 1 year ago (1 children)

Fair enough. Point is nothing is getting smaller except the call stack.

[–] [email protected] 4 points 1 year ago

The thing that's getting smaller is the "complexity" or "distance from the trivial case" of the function invocation. This is an informal notion though.

[–] [email protected] 1 points 1 year ago (2 children)

Of course it does, I suggest you go read about recursion. Here's a link: https://www.cs.odu.edu/~toida/nerzic/content/recursive_alg/rec_alg.html

Good luck

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago)

There's no formal reason why the input to a recursive function must be a "smaller" or "simpler" version of itself, that's just a way of explaining it intuitively/informally. You need to reduce the "complexity" (meant informally as 'deviation from a trivial case') at every step (only) if you want to the algorithm to actually finish.

[–] [email protected] 0 points 1 year ago (1 children)

I've been writing code for 35 years and professionally for 25. I'm plenty familiar with it.

[–] [email protected] 1 points 1 year ago (2 children)

And still you get it wrong. I just linked you an academic article about it, fml. Never got people who are to proud to admit they are wrong.

[–] [email protected] 2 points 1 year ago

What the flip did you just freaking say about my code, you little script kiddie? I'll have you know I've been writing code for 35 years and I've used recursion on several occasions, and I have over 300 confirmed successful deployments. I am trained in twelve different programming languages and I'm the top coder in the entire Stack Overflow leaderboard. You are nothing to me but just another code review. I will debug you the flip out with precision the likes of which has never been seen before on this GitHub, mark my freaking words. You think you can get away with saying that crap to me over the Internet? Think again, scripter. As we speak I am contacting my secret network of tech support across the globe and your IP is being traced right now so you better prepare for the DDoS, maggot. The storm that wipes out the pathetic little thing you call your Python script. You're freaking terminated, kid. I can be anywhere, anytime, and I can refactor your code in over seven hundred ways, and that's just with my bare hands. Not only am I extensively trained in machine learning, but I have access to the entire arsenal of Google Cloud Services and I will use it to its full extent to wipe your miserable code off the face of the repository, you little wannabe. If only you could have known what unholy retribution your little 'clever' comment was about to bring down upon you, maybe you would have held your tongue. But you couldn't, you didn't, and now you're paying the price, you goddamn rookie. I will rain code all over you and you will drown in it. You're freaking done, kiddo.

[–] [email protected] 1 points 1 year ago

Point is I know how it works. Maybe you want to argue the analogy, but that doesn't mean I don't understand recursion. I've used it on several occasions.