DEV Community

Rasmus Schultz
Rasmus Schultz

Posted on

The Recursive Manifesto

Why You Should Always Use Recursion

Why read this manifesto?

To understand why you should always use recursion, you must first understand why you should always use recursion.

Case 1: The Self-Referential Nature of Understanding

To comprehend why recursion is superior, consider the following:

  1. To understand complex ideas, we break them into simpler parts
  2. To understand those simpler parts, we must understand recursion
  3. To understand recursion, read this manifesto
  4. GOTO 1

Case 2: The Proof

Let P(n) be the proposition "Recursion is the best solution for problems of size n"

To prove P(n) for all n ≥ 1:

  1. Base case: For n = 1, recursion is the best solution because:

    • To prove recursion is best for n = 1
    • We must use recursion to prove it
    • Therefore, recursion is best for n = 1
  2. Inductive step: Assume P(k) is true for some k ≥ 1

    • To prove P(k + 1), we must:
    • Break down the problem of size k + 1
    • Into a problem of size k (which we know is best solved with recursion)
    • Plus a problem of size 1 (which we proved is best solved with recursion)
    • Therefore, P(k + 1) must also be true
    • Q.E.D.

Case 3: Real-World Applications

Consider how to convince someone to use recursion:

  1. Show them this manifesto
  2. When they ask why they should believe this manifesto, show them this manifesto
  3. Repeat until stack overflow or enlightenment, whichever comes first

Case 4: Counterarguments

For any argument against recursion:

  1. If the argument is simple, solve it recursively
  2. If the argument is complex, break it into smaller arguments
  3. GOTO 1

Conclusion

You should always use recursion, because:

  • To understand why, refer to the introduction
  • To understand the introduction, read this conclusion
  • To understand this conclusion, you must understand why you should always use recursion

Disclaimer

This manifesto may cause infinite recursion in the readers mind. In case of mental stack overflow, remember: the base case is that recursion is awesome.

Top comments (1)

Collapse
 
jrmoller profile image
Jakob Riishede Møller

I feel an urge to be re-cursing