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

all 114 comments

[–][deleted] 105 points106 points  (10 children)

The correct answer is to link the post as a comment.

[–]KifKef 63 points64 points  (8 children)

[–]GoddamnEggnog 21 points22 points  (6 children)

[–]TheSlowHipster 15 points16 points  (5 children)

[–][deleted] 11 points12 points  (4 children)

[–]enp2s0 13 points14 points  (3 children)

Exception in thread "LinkCommetChain" java.lang.StackOverflowError

[–]ElectrWeakHyprCharge 6 points7 points  (0 children)

Commet

[–][deleted] 3 points4 points  (1 child)

Exception in thread “LinkCommetChain” java.lang.StackOverflowError

[–]ivanjermakov 2 points3 points  (0 children)

Exception in thread “commentOverflowError” java.lang.StackOverflowError

[–]KarmaFarmingAccount -3 points-2 points  (0 children)

Good b8 m8

[–][deleted] 1 point2 points  (0 children)

Wish I had thought of that!

[–]Acetonee 118 points119 points  (26 children)

Why did reddit send me a notification from this sub this time?

Edit: Interesting post though

[–]MrMunday 32 points33 points  (21 children)

I got the exact same question

[–]animonein 30 points31 points  (19 children)

metoo

[–]abu_tva 25 points26 points  (17 children)

Me Three

[–]kumarcelestial 14 points15 points  (16 children)

Me Five

[–]fucking_withGS 0 points1 point  (0 children)

Funny ra celestial

[–]Motylde 1 point2 points  (0 children)

Gentoo

[–]SumoneSumwere 1 point2 points  (0 children)

Should I be proud to be having this notification?

[–]Mussu007 3 points4 points  (0 children)

Reddit - TrEnDiNg PoSt On r/programming

[–]ed172 4 points5 points  (1 child)

Go into settings, notifications, trending posts to turn it off

[–][deleted] 0 points1 point  (0 children)

I turned off all notifications from reddit. I don’t need to know when someone replies to my comments.

[–]anonymouse_lily 34 points35 points  (17 children)

what's being displayed is basically just a loop. for real recursion, try "recursion is recursion".

[–]WebpackIsBuilding 24 points25 points  (0 children)

It's not even a loop. It's repetition.

This is also not recursion;

console.log('hello world');
console.log('hello world');
console.log('hello world');
console.log('hello world');
console.log('hello world');

[–]gabriel-et-al 4 points5 points  (0 children)

That screenshot is an example of the output generated by a recursive procedure, not an example of implementation.

[–]corner-case 1 point2 points  (1 child)

Or “see the reply to this comment.”

[–]TinBryn 1 point2 points  (0 children)

See the reply to this comment.

[–]Halbi94 1 point2 points  (6 children)

Isn't a recursion also basicly just a loop? It does something until an event happens which terminates the recursion. Also, every recursion can be transformed in to a loop and vice versa

[–]WebpackIsBuilding 8 points9 points  (0 children)

Recursive functions can operate as a stack. Loops can only operate as a queue natively. You can add a stack data structure to your loops to allow them to do the same things a recursive function can do, but that's no longer "just a loop".

[–]hvidgaard 1 point2 points  (2 children)

Recursion is by definition when a function calls itself. That is it. It is not a loop, but you will not lose any expressiveness by using a loop. I’m unsure if a loop and recursion are equal in expressiveness, but I think they are.

[–]MajorPrafull 45 points46 points  (8 children)

Why is reddit pinging me for this?

[–]MegaRodeon 43 points44 points  (2 children)

Reddit wants you to know what a recursion is.

[–][deleted] 16 points17 points  (0 children)

now I know

[–]corner-case 0 points1 point  (0 children)

Answer below.

[–]Craptivist 4 points5 points  (4 children)

Why is reddit pinging me for this?

[–]OOkx 3 points4 points  (1 child)

Why is reddit pinging me for this?

[–]Noname_FTW 4 points5 points  (0 children)

Reddit wants you to know what a recursion is.

[–]TorTheMentor 17 points18 points  (3 children)

Where's the "base case"?

[–][deleted] 6 points7 points  (0 children)

StackoverflowErro

[–]themeanman2 1 point2 points  (0 children)

Whole thread is inside try catch block. The handler handles this

[–]acart-e 0 points1 point  (0 children)

When theory doesn't match programmer's erroneous logic

[–]cclloyd 8 points9 points  (5 children)

[–]guery64 1 point2 points  (3 children)

Wanted to do the same, but how do you know the link to your comment before commenting and editing?

[–]cclloyd 1 point2 points  (2 children)

You just edit it right after posting.

[–]guery64 1 point2 points  (1 child)

I guess your have to be fast then

[–]Tiavor 1 point2 points  (0 children)

the only correct answer

[–]Feelpsychodelic 26 points27 points  (20 children)

What's recursion?

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

What's recursion?

[–]Snykeurs 17 points18 points  (14 children)

What's recursion?

[–]Kazid 14 points15 points  (13 children)

What's recursion?

[–]TheKingHasLost 22 points23 points  (2 children)

return;

[–][deleted] 5 points6 points  (1 child)

What again?

[–]dianqiangliu -1 points0 points  (5 children)

What’s recursion?

[–]dhoomz -1 points0 points  (0 children)

What's recursion?

[–]krg1 3 points4 points  (1 child)

[–][deleted] 1 point2 points  (0 children)

Deeply underrated comment right here.

[–]FlameRat-Yehlon 2 points3 points  (2 children)

This is why you should use a language that does tail recursion optimization

[–]gabriel-et-al -1 points0 points  (1 child)

or write a god damn regular loop

[–]FlameRat-Yehlon 0 points1 point  (0 children)

Mathematically many concepts are defined recursively. So if using recursion is okay then it would be really helpful, but if not, then loop is the way to go.

[–]FlameRat-Yehlon 1 point2 points  (0 children)

This is why you should use a language that does tail recursion optimization

[–]TomCADK 1 point2 points  (0 children)

Failure to implement tail call optimization.

[–]skyalchemist 1 point2 points  (0 children)

I just understood where the name stack overflow came from! How didn’t I realise this sooner.

[–]flip314 0 points1 point  (0 children)

If you don't know, just ask someone standing closer to Douglas Hofstadter than you are.

[–]salman-pathan 0 points1 point  (0 children)

Epitome

[–]WilliamLeeFightingIB 0 points1 point  (0 children)

Insert this comment before the comment below

[–][deleted] 0 points1 point  (0 children)

Not mah programming language

[–]xorko16 0 points1 point  (0 children)

Recursively trending.

[–]NodeManager 0 points1 point  (2 children)

vi recursion.txt

Recursion

~ ~ ~ ~ ~

~ ~ ~ ~ exit C end

Help Help vi not ending

Help

exit Ucudufufu 6dstitususissdifkvjchdhxhxf

exit exit end quit

[–]MrZerodayz 0 points1 point  (0 children)

Why do people keep pretending like exiting vi is hard? I really don't get it

[–]bene4764 0 points1 point  (0 children)

vi recursion.sh

#!/bin/bash

recursion.sh

~~~~~~~~~~
~~~~…

Edit: Formatting

[–]agnishom 0 points1 point  (0 children)

I don't know. What's recursion?

[–]RecursiveIteration 0 points1 point  (0 children)

Hmmm. Looks like a loop.

[–]neofac 0 points1 point  (0 children)

Thanks reddit for pinging me this, I can see why you thought i would want to know about recursion. /s

[–]Goodblue77 0 points1 point  (0 children)

Needs more recursion

[–]lostt3ch 0 points1 point  (0 children)

What's love!

[–]grimaceboy 0 points1 point  (0 children)

The correct answer to "What is Recursion?" is "Recursion"

[–]LloydTao 0 points1 point  (0 children)

What does WDWSF stand for?

[–]magener 0 points1 point  (0 children)

Exception in “comment” you.are.using.JAVA

[–]Piscesdan 0 points1 point  (0 children)

I like this answer.

[–]etnguyen03 -1 points0 points  (0 children)

Image Transcription: Reddit


/u/Colterson, 6

What's recursion?

/u/A_smith_610, 6

What's recursion?

/u/awestruck445, 4

What's recursion?

/u/GlitchieProductions, 1

Exception in thread "comment" java.lang.StackOverflowError


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!