Re:If a callback calls the enclosing function, would it be c...
by anuragpeshne on Tuesday January 20, 2015 @12:57PM
(#8918274)
Thanks, "I would not call it a recursive function just because it calls itself; I'd call it a self-referencing function." - this cleared a lot of things. I'll a write an answer based on this and other things that I read. This will help someone someday.
1. Why does it matter?
2. Your first example I would simply call an asynchronous loop.
3. Your second example could possibly be called single recursion.
4. Recursion should at least consist of a base case and a recursive case, each self-reference should bring the input value closer to the base case which would end the recursion.
(Your second example has a recursive case and falls out into an undefined base case).
5. An example of 4 would be a tree structure where the base case is a leaf and recursion cases are branches.
would output: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14