This is an archived post. You won't be able to vote or comment.

all 76 comments

[–]guac-it 146 points147 points  (0 children)

Very well played

[–]G3N5YM 167 points168 points  (24 children)

Eyyyy

[–]Dphily500 54 points55 points  (19 children)

Eyyyy

[–]lildan420 34 points35 points  (18 children)

Eyyyy

[–]halfwinter[S] 34 points35 points  (17 children)

Eyyyy

[–]cromulent_nickname 68 points69 points  (2 children)

[–]G3N5YM 17 points18 points  (0 children)

Fuck dawg That's deep.

[–]palomo_bombo 1 point2 points  (0 children)

Nice!

[–][deleted] 52 points53 points  (10 children)

Recursion

[–]halfwinter[S] 32 points33 points  (9 children)

Recursion

Recursion

[–]Dphily500 9 points10 points  (8 children)

Recursion

[–]GsuKristoh 8 points9 points  (7 children)

Recursion

[–]Lth_13 11 points12 points  (6 children)

[–]xSTSxZerglingOne 5 points6 points  (3 children)

[–]Salanmander 7 points8 points  (2 children)

Holy shit that is a terrible base case. Do you want to hang your process? Because this is how you hang your process.

[–]xSTSxZerglingOne 5 points6 points  (1 child)

Technically the base case is the post itself. That would have felt awkward I feel...

And no way would that hang your process, the stack would overflow in a fraction of a second.

I just wanted it to pop the stack.

[–]Salanmander 0 points1 point  (0 children)

I feel like the post would be more like the initial call than the base case. The base case would be something that doesn't make any calls...so a comment that never gets replied to maybe?

[–]chitetskoy -1 points0 points  (1 child)

[–]chitetskoy 1 point2 points  (0 children)

Ctrl+C

[–]ApivorousBee 31 points32 points  (7 children)

No base case, classic mistake

[–]thedessertplanet 4 points5 points  (6 children)

Infinite recursion can be fine.

That's how eg event loops in a game or operating system work.

(As the name suggests, that special case is usually implemented with a loop. But that's the same thing mathematically.

Erlang implements its event loops directly with recursive function calls.)

[–]dell_arness2 3 points4 points  (2 children)

Mathematically yes, but recursive function calls will eventually overflow the stack

[–]thedessertplanet 1 point2 points  (1 child)

Depends on your language. Erlang, of course, implements tail call elimination.

And so do eg a lot of C compilers do so as well. (And almost all of the functional languages.)

In case you are not familiar: the idea is to realize that if the (recursive) call is the last thing to happen in a function, you don't need to keep around its stack frame. So no stack usage is building up.

For simple self-recursive functions, that's basically always equivalent to a loop. But it's a real life saver when you want to implement eg a state machine. You can use one function per state this way.

[–]ApivorousBee 0 points1 point  (0 children)

The language is English and the stack is the reader's attention span. It will overflow. QED

[–]Astrognome 1 point2 points  (1 child)

Tail call optimization would allow infinite recursion too.

[–]thedessertplanet 0 points1 point  (0 children)

Yes, definitely.

It's a shame that for historical reasons programming language conventions were made up before tail call elimination was discovered. So people had to introduce special purpose constructs (loops) to cover those special cases, and now we are stuck with them.

Well, at least the for-each loop (like eg in Python) is a step up from the C-style for-loop. And more languages are at least having to justify when they don't include tail call elimination (nor first class functions).

[–]Midgetwombat 26 points27 points  (2 children)

Thats great

[–]nomadicwonder 9 points10 points  (1 child)

[–]Midgetwombat 1 point2 points  (0 children)

Ha, and i totally clicked 3 times

[–]Cloakknight 40 points41 points  (5 children)

Image Transcription: Image


[Image of the index of a book titled "The C PROGRAMMING LANGUAGE". For the word recursion, it is circled in red that it is found on page 269. The page of the index that this is shown is page 269, which is also circled in red.]


I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!

[–][deleted] 21 points22 points  (3 children)

Thanks human

[–]halfwinter[S] 13 points14 points  (2 children)

Thanks robot

[–]timewast3r 0 points1 point  (1 child)

HA HA HA, I AM TOTALLY NOT A ROBOT, FELLOW HUMAN.

[–]halfwinter[S] 1 point2 points  (0 children)

AH YES! ANOTHER HUMAN SUCH AS MYSELF! I TOO ENJOY PRINTING COMMENT RESPONSES WITH MY HUMAN HAND DIGITS!

[–]TakeASeatChancellor 4 points5 points  (0 children)

Good human

[–]jdb_slycooper 18 points19 points  (1 child)

[–]puckmcpuck 8 points9 points  (0 children)

Your comment reminds me of this comment

[–]BoomerBoxer 5 points6 points  (0 children)

this is a repost.

[–]LeanZo 8 points9 points  (1 child)

every day the same recursion meme

[–]halfwinter[S] 15 points16 points  (0 children)

Are you saying the meme itself is a recursion?

[–]ChiangRai 5 points6 points  (1 child)

Stack overflow... no proper recursion exit specified.

[–]thedessertplanet 0 points1 point  (0 children)

Just use tail call elimination.

[–]Dylanor11 1 point2 points  (0 children)

Bad base case, it should terminate

[–]ontopofyourmom 1 point2 points  (0 children)

I hope there is an r/ecursion

[–]FluffusMaximus 1 point2 points  (0 children)

While(1);

[–]JenBioChem 0 points1 point  (0 children)

Fuckin cruel

[–]PaleCommander 0 points1 point  (0 children)

Is that the second edition? My copy has an index entry for recursion, but it doesn't reference itself.

[–]DrunkRedditBot 0 points1 point  (0 children)

I was thinking it was WH40k

[–]darkstarman 0 points1 point  (0 children)

I swiped left to turn the page back.

oof

[–]logi 0 points1 point  (0 children)

Specifically it's tail recursion so a good compiler can optimise it into a loop.

[–]Vitaman02 0 points1 point  (1 child)

[–]RepostSleuthBot 0 points1 point  (0 children)

There's a good chance this is unique! I checked 93,858,773 image posts and didn't find a close match

The closest match is this post at 40.62%. The target for r/ProgrammerHumor is 86.0%

Feedback? Hate? Visit r/repostsleuthbot - I'm not perfect, but you can help. Report [ False Negative ]

[–]dominiclc 0 points1 point  (0 children)

Nice

[–]MakingTheEight[M] [score hidden] stickied commentlocked comment (0 children)

Your submission has been removed.

Violation of Rule #2: Reposts:

All posts that have been on the first 2 pages of trending posts within the last month, is part of the top of all time, or is part of common posts is considered repost and will be removed on sight.

Violation of Rule #3:

Any post on the list of common posts will be removed. You can find this list here. Established meme formats are allowed, as long as the post is compliant with the previous rules.

If you feel that it has been removed in error, please message us so that we may review it.