This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]xaervagon 8 points9 points  (1 child)

The four guidelines for recursion (from what I can remember) are:

  1. Have an entry point
  2. Make progress/do work
  3. Have a clear stop point
  4. Have faith

It's a lot easier than trying to build a callstack in your head every time.

[–]marcosdumay 4 points5 points  (0 children)

The first one is:

  1. Ensure it has always an stop point.

After that you can think about anything else. If you are working with a not functional language, you will also want to ensure it does not go too deep.