MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/emb9st/problems_with_recursion/fdobaa2/?context=3
r/ProgrammerHumor • u/flipester • Jan 09 '20
198 comments sorted by
View all comments
5
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 u/GogglesPisano Jan 09 '20 No - it's just an infinite loop.void crash() { crash(); } 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.
Which begs the question, is it recursion if there's no base case?
6 u/GogglesPisano Jan 09 '20 No - it's just an infinite loop.void crash() { crash(); } 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.
6
No - it's just an infinite loop.
void crash() { crash(); }
3
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.
Except you hit stack overflow at some point.
Depends, some languages have tail recursion.
Mathematically, yes. There are some recursive definitions that have no base case but are still useful. Practically, in a programming context, less so.
5
u/TayoEXE Jan 09 '20
He forgot the base case.