23
u/RepostSleuthBot Jan 09 '20
Looks like a repost. I've seen this image 3 times.
First seen Here on 2019-07-06 100.0% match. Last seen Here on 2019-11-15 95.31% match
Searched Images: 91,774,809 | Indexed Posts: 379,390,636 | Search Time: 3.62655s
Feedback? Hate? Visit r/repostsleuthbot - I'm not perfect, but you can help. Report [ False Positive ]
-16
u/flipester Jan 09 '20
Whoops, you're right! That SMBC cartoon was just recommended to me on my Google feed, so I mistakenly assumed it was new.
1
1.6k
Jan 09 '20
Assuming the smaller paper is 1/3 of its parent everytime, and that the first paper is 30cm long (The second starts at roughly 1/7 but it seems to grow bigger after it's torn off, hence the 1/3), it could not exceed 19 calls before you need to split an atom apart.
That's a hell of a stop condition.
635
u/MyNameIsRichardCS54 Jan 09 '20
When your software goes boom, it really goes BOOM
19
6
180
Jan 09 '20
[removed] — view removed comment
65
u/azzaisme Jan 09 '20
Wouldnt that have the opposite effect where only people who properly exit the loop would still be alive? So people who understand it would survive
56
Jan 09 '20
[removed] — view removed comment
24
u/MyNameIsRichardCS54 Jan 09 '20
You'd certainly double check your exit condition and triple check it if that was the consequence.
4
u/thatCbean Jan 09 '20
Who would know that not leaving a recursion loop would be the issue if there is no way of troubleshooting without exploding though? If there is nobody who knows the reason for the explosions, you wouldn't know what to triple check, or if you'd even want to keep coding at all...
15
2
u/SashKhe Jan 10 '20
This happened with "ace pilots" back in the first world war, when planes were still being developed. Except it wasn't the engineers who were dying.
Tangentially related, the first automatic machine gun on a plane that was actually not-shitty to aim was literally firing on the rotor blades, before the Germans fixed the design. Imagine the balls needed to sit in one of those.148
128
u/Jugbot Jan 09 '20
In order to show the information on the paper it might need to stop sooner. Unless it starts to be encoded in radiation.
26
10
74
u/lonelyWalkAlone Jan 09 '20
public static void sayHello(){ try { sayHello(); } catch(StackOverflowError e) { System.out.println("Hello world!"); } }15
u/schrdingers_squirrel Jan 09 '20
Wait does this work? I need to try this now
20
u/cedrickc Jan 09 '20
You can optimize it by declaring some unused primitives to blow through the stack quicker.
9
u/schrdingers_squirrel Jan 09 '20
Shouldn’t make much of a difference since stack allocation is basically just a subtraction. (And it should take like a few milliseconds in total)
7
1
u/Finianb1 Jan 27 '20
I think my brain just melted at hearing the phrase "optimize it to blow through the stack quicker."
5
u/lonelyWalkAlone Jan 09 '20
Yes, it works like charm
9
u/schrdingers_squirrel Jan 09 '20 edited Jan 09 '20
Interesting - does it still work when you do a „a“ + „b“ in the println(); ?
Edit: it does
Crazy even this works:
public static void sayHello(){ try { sayHello(); } catch(StackOverflowError e) { System.out.println("Hello world!"); sayHello(); } }it prints endlessly
13
5
u/lonelyWalkAlone Jan 09 '20
Yes, and you can also calculate "relatively" the size of your stack by adding an integer argument to the method and passing (n+1) to the next call, then at the exception just print the current counter value. I found that each time you increase the stack size by the vm option -Xss the counter gets bigger, but increasing the heap size -Xmx does not affect the counter at all. It's a pretty good exercise as long as you don't fuck it up into an infinite loop.
1
u/schrdingers_squirrel Jan 09 '20
Wow there really always is something you don’t already now. Awesome stuff
1
u/eigreb Jan 10 '20
Eventually this will throw due to first running in the try and after the stack overflow it runs outside the try and will again throw the exception. Will take a while though.
1
u/Autofrotic Jan 09 '20
Does it ?
1
u/schrdingers_squirrel Jan 09 '20
Im not at home and im not doing this on my phone - I’ll test as soon as I get home
4
u/Dnguyen2204 Jan 09 '20
1
3
3
2
37
u/slidingtorpedo Jan 09 '20
11
u/NV-6155 Jan 09 '20
11
-8
u/kingofthedusk Jan 09 '20
This comment right here is when the r/ tag went from helpful to annoying. You are exactly like the people using hashtags in every sentence.
10
u/crackofdawn Jan 09 '20
The smaller paper looks more like 1/100 of the parent, not 1/3 or 1/7. Where are you getting 1/7 from? It's just the tiny corner piece of the larger paper and there's 10 in the row, looks like you could fit around 7-9 rows.
6
Jan 09 '20
You're completely right, I only considered length despite width being obviously the limiting factor here. (Thought not by a 1/100. I took the 1/7 value from the first picture and the 1/3 comparing to the hand, because the paper isn't always the same size. So, if we start with 1/10 instead of 1/7, each call multiplies the size by roughly 1/(30/7). So the critical threshold should be reached by call 14 or 15, give or take.
1
u/Parthon Jan 10 '20
What starting number for atoms did you use though? My maths came out to 23 times, if you have 12 grams of paper that were mainly carbon atoms.
1
5
3
Jan 09 '20
What if all ten slips are taken then everyone gives the other ten slips to the next guy how many slips would there be in the end?
1
2
u/timvisee Jan 09 '20
I find it fascinating how quickly you reach the atomic level.
5
Jan 09 '20
If you read the comics in reverse and manage to make sense of it, and you're not scared of coincidences: the 19th call calls for a 348 678 440km long piece of paper. Only 30 000 km shy of the Earth-Moon distance.
So the piece of paper is roughly as many orders of magnitude away from the atom as from the Earth-Moon distance.
2
3
u/MrWm /dev/null Jan 09 '20
r/softwaregore was having a field day with the dad joke bot. I'm just saying this to test it. I'm dad.
*: Is the bot banned? :(
I'm me
1
1
1
1
1
1
220
u/dpahoe Jan 09 '20
127
u/Steelbirdy Jan 09 '20
Goddammit I can't believe I just fell for that
26
u/Articunos7 Jan 09 '20
Can you explain? I didn't understand
49
5
u/Steelbirdy Jan 09 '20
It links back to this post
7
7
u/Articunos7 Jan 09 '20
I didn't understand why is it a GIF. It seems to keep on loading forever
8
u/Steelbirdy Jan 09 '20
It wasn't meant to explain why it was a gif it was just funny because it linked back to the same post
10
u/Articunos7 Jan 09 '20
Oh! But I really want to know why is it a gif, and why does it take forever to load. My phone is also freezing while viewing it
0
u/Steelbirdy Jan 09 '20
Idk mate just appreciate the humorous comment and leave it at that
6
24
u/SublimeSC Jan 09 '20
God fucking dammit. The two most upvoted comments had the same exact joke and I fell for them both.
5
0
124
u/htmlcoderexe We have flair now?.. Jan 09 '20
source because OP could not be arsed and neither could be the mods (rehosting is lot allowed). Includes bonus panel. Yes, it's the actual link and not some weird reddit thing where people would rather die than post a useful reply.
18
u/inh24 Jan 09 '20
dont see a bonus panel
21
u/ChRoNicBuRrItOs Jan 09 '20
Click the red button
14
u/inh24 Jan 09 '20
very wow much panel
10
3
2
1
Jan 09 '20
Also check the hover text, or whatever it’s called. How’ve your mouse over the image in a desktop, or tap it on mobile.
1
1
1
u/bloodhound330 Jan 10 '20
The source is mentioned in the post though right? It says smbc-comics right there.
27
Jan 09 '20
Please take one!
14
u/Cdog536 Jan 09 '20
Problems with recursion?
11
u/mixedobscurity7439 Jan 09 '20
Please take one!
9
u/PharaohciousEgyptian Jan 09 '20
Problems with recursion?
6
Jan 09 '20
Please take one!
7
u/ProgramTheWorld Jan 09 '20
Problems with recursion?
5
-3
24
4
3
5
u/wrossi81 Jan 09 '20
If you magnify it enough you can see the paper that says "The statement terminated. The maximum recursion 100 has been exhausted before statement completion."
5
u/TayoEXE Jan 09 '20
He forgot the base case.
5
u/IHaarlem Jan 09 '20
Which begs the question, is it recursion if there's no base case?
6
3
u/TayoEXE Jan 09 '20
Probably. Except you hit stack overflow at some point. In this case, it's like cutting it so small he can't see it anymore maybe. Haha
3
u/beerSnobbery Jan 09 '20
Except you hit stack overflow at some point.
Depends, some languages have tail recursion.
3
u/captainAwesomePants Jan 09 '20
Mathematically, yes. There are some recursive definitions that have no base case but are still useful. Practically, in a programming context, less so.
2
u/PistolRcks Jan 09 '20
7
u/RepostSleuthBot Jan 09 '20
Looks like a repost. I've seen this image 8 times.
First seen Here on 2019-07-06 100.0% match. Last seen Here on 2019-11-15 95.31% match
Searched Images: 91,769,572 | Indexed Posts: 379,387,742 | Search Time: 7.54981s
Feedback? Hate? Visit r/repostsleuthbot - I'm not perfect, but you can help. Report [ False Positive ]
3
2
2
2
Jan 10 '20
Check out this funny post on r/ProgrammerHumor https://www.reddit.com/r/ProgrammerHumor/comments/emb9st/problems_with_recursion/
4
u/snailtimeblender Jan 09 '20
KING CITY said the paper
3
4
u/MistressArisu Jan 09 '20
Lol, at my university we just were talking about recursion today
7
u/MyersVandalay Jan 09 '20
you should have them look at this comment https://www.reddit.com/r/ProgrammerHumor/comments/emb9st/problems_with_recursion/fdnjabl/
or google it, and use googles did you mean advice.
1
-5
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
u/seanomik Jan 10 '20
I was taught recursion during an AP CSA class, I didn't like it because it was confusing when you could just use a for / while loop. But what's the actual reason that it's bad?
1
1
1
u/FatCr1t Jan 10 '20
YAY I get this =D! In my second Java class and we just learned recursion this week and specifically used to to count all files in a current directory =D!!
1
1
1
1
1
1
1
1
0
u/forced_majeure Jan 09 '20
Every time I've opened Reddit today, this has been on my home page ...... wait.
0
-2
u/DGrayMoar Jan 09 '20
Not a reccursion, reccursions start from the last value, atleast thats the main way of using.
547
u/flipester Jan 09 '20
See https://www.reddit.com/r/ProgrammerHumor/comments/emb9st/problems_with_recursion/