6 ms·
Recursion and Abstraction, like love and herpes, are a form of disease which once caught cannot be lost, but can be shed, and so spread. Your brain is wired to
by ggm 7y ago
Recursion and Abstraction, like love and herpes, are a form of disease which once caught cannot be lost, but can be shed, and so spread. Your brain is wired to look for both opportunistically, in any problem.
What a CS degree does, is teach you how to apply the infection. Some CS degrees are like innoculation against them and you come out with a degree, but no grasp of the fundamentals. Others, you learn so much you become a vector of the disease.
- deleted 7y ago[deleted]
- vegiraghav 7y agorecursion overrated imo.
- ggm 7y agoiteration gets repetitive.
- commandlinefan 7y agorecursion is full of itself, though.
- berbec 7y agoiteration gets more repetitive.
- pmiller2 7y ago> recursion is overrated imo Right up until the point where you have to traverse a nested data structure.
- aitchnyu 7y agoRecursive algorithms are a natural fit for recursive data structures. Recursive Fibonacci is contrived. </cliche>
- arendtio 7y agoI disagree. To consider something overrated, its value has to be little in comparison to the effort to learn it. For some problems, recursion is vastly superior e.g. for recursive data structure like trees. And coincidentally, often those structures are much better at delivering high-performance solutions than their naive loop-based counterparts. Granted, it isn't easy to learn, but also not that hard. Overall, I think the gains easily outweigh the effort. And it is not like I am writing recursions all day long. Most of the time I write loops, but you should know when using recursions is the better way to go and for those times you should know how to handle them.
- nh2 7y agoNote that using function-call based recursion is a programming mistake in most common programming languages, as they have a fixed sized stack. This includes many "functional" languages like Scala. Even Haskell had a default stack size limit until some years ago, and many Haskell based parsers crashed on large inputs due to that. If you write programs that are supposed to process arbitrarily large inputs, you cannot use function call recursion in most cases. (Of course this says nothing about recursion as a concept, which is fundamental and unavoidable unless you're programming, say, a traffic light.)
- tracker1 7y agoOf course, it's also possible to over-apply, which I see every bit as often as copy-pasta.
- deleted 7y ago[deleted]