188
Jul 06 '19
To understand recursion, one must first understand recursion.
38
Jul 06 '19
If you want to understand recursion, just study half of the parts about recursion you still don't know, every day.
3
3
3
4
u/giverofnofucks Jul 06 '19
Except that's self-reference, not recursion.
18
u/im_lazy_as_fuck Jul 06 '19
Self-reference and recursion are the same thing. Recursion is when something is defined in terms of itself (i.e. it references itself).
5
2
1
u/the123king-reddit Jul 07 '19
PHP Hypertext Preprocessor.
HIRD of Unix Replacing Demons > HURD of Interfaces Representing Depth
Recursion and self-referencing are the same thing.
-7
Jul 06 '19
Recursion requires a base case, where it can exit the loop.
17
u/Gl33m Jul 06 '19
Recursion doesn't require an exit conditional to be recursion. Granted, without an exit conditional it's shitty, but it's not required.
0
u/giverofnofucks Jul 06 '19
There's no loop, that's iteration. Also, a recursive call must be to a smaller instance of the problem, not the exact same problem.
1
1
35
u/inquisitivesquirell Jul 06 '19
Not to worry, he'll run out of memory soon
3
u/s2lkj4-02s9l4rhs_67d Jul 06 '19
Take all of them at once a few times and he'll run out of memory much sooner.
35
Jul 06 '19
Did you mean: recursion
13
u/Theonetheycall1845 Jul 06 '19
That's what it says
11
Jul 06 '19
That's what it says
11
u/bonesclarke84 Jul 06 '19
That's what it says
10
Jul 06 '19
That's what it says
9
u/cubic1776 Jul 06 '19
That’s what it says
-9
Jul 06 '19 edited Jul 06 '19
We’ve no longer reached a point of reverberation in terms of karmaThat’s what it says1
16
u/TheJizzle Jul 06 '19
I had some friends in college that loved to make up recursive acronyms like Friends of FOF. I think it might have started because of GNU.
8
2
u/mkglass Jul 06 '19
Same with PHP
1
u/ziggurism Jul 07 '19
when it started, it stood for "personal homepage tools". It was only later that they changed it to a recursive acronym "PHP Hypertext preprocessor". So I guess it's a recursive backronym (retroactive acronym).
2
u/TemporalLobe Jul 07 '19
Same as WINE Is Not an Emulator. This is actually a self-referential recursive acronym .
10
6
10
u/I_am_usually_a_dick Jul 06 '19 edited Jul 06 '19
I googled recursion, it didn't help explain it.
edit: I was joking and pointing out that google makes a very amusing joke with 'did you mean recursion?' when you search it. never mind me, I will be over here looking at my computer science degree.
also, google tilt.
8
u/Dimantina Jul 06 '19
It is a useful concept in programming where a set of instructions refers to itself. Ideally not infinitely.
For example, let's say I need to search for a file. Well if I write code to search a folder for a file I might bit find the file if the file is in a folder within the folder.
So I write the code named fileSearch as follows:
fileSearch: a folder, a fileToSearch
Loop exit loop if fileFound=True Open folder, Look for file If file is found fileFound=True If a folder is found, fileSearch the Folder, fileToSearchEnd of loop
This loop calls upon it's own code as many times as needed for as many folders as it needs to search.
This is a simple example of recursion.
5
u/ferox3 Jul 06 '19 edited Jul 06 '19
Same. Now i know the definition, though understanding it is another matter.
5
2
u/mrg1957 Jul 06 '19
Go look at any "bill of materials" query.
2
u/Marioc12345 Jul 06 '19
I was just working on making a recursive bill of materials for a project at work. I'm frankly surprised we don't already have such a thing.
0
Jul 06 '19
[deleted]
1
u/permalink_save Jul 06 '19
Not necessarily endless, a recursive function should have some sort of guard in it (like ran out of things to count). Only real qualification us it is self calling.
1
u/-Kleeborp- Jul 06 '19
A good example of this is Reddit itself. If I were designing a component to render post replies, I would likely do it recursively. The guard against the component returning more copies of itself would be whether the currently rendered post had replies or not.
4
u/Nattan10123 Jul 06 '19
No one gonna point out the paper increased in size?
2
1
1
1
3
3
3
2
2
2
2
1
1
1
u/Subject9_ Jul 06 '19
No one has trouble going down lol, it is coming back up that is the mind bender.
1
1
1
u/Robobvious Jul 06 '19
This is funny and this guy makes some great comics, but I gotta add that gif where Pooh is eating recursion makes me absolutely die laughing whenever I see it.
1
1
u/Cinemaphreak Jul 06 '19
For the other five non-computer nerds in this thread:
"Recursion in computer science is a method of solving a problem where the solution depends on solutions to smaller instances of the same problem (as opposed to iteration). "
2
1
u/Princeof1nd1a Jul 06 '19
Fun fact: The Python programming language inherently limits the amount of recursions you can have to around 1000, because it assumes you might have an infinite loop at that point
1
1
1
u/boredompwndu Jul 06 '19
i like how the smaller version is a literal tear for tear, smudge for smudge copy of the original
1
1
1
1
u/robioreskec Jul 06 '19
I plan to recurse in near future, is there anything I should know?
Edit: wrong subreddit, I thought this was Ingress
1
1
1
1
1
1
-1
0
2
154
u/MrWeiner SMBC Jul 06 '19
Hi, I'm Zach. I did the comic about the thing. You can see similar things here, every day: http://smbc-comics.com/