this post was submitted on 21 Jul 2023
837 points (97.4% liked)
Programmer Humor
19817 readers
1057 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
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I think the foreach one should have been recursion.
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 :)
I disagree. Recursion is the same thing over and over again until the exit condition. Nothing is getting smaller except the remaining entries.
That's just "recurrence." The same as a "while" loop. Recursion is specifically when a procedure invokes itself.
Fair enough. Point is nothing is getting smaller except the call stack.
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.
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
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.
I've been writing code for 35 years and professionally for 25. I'm plenty familiar with it.
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.
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.
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.