Thursday, February 13, 2014; 3:13:23 PM Eastern
Tail recursion in JavaScript
- I love JavaScript. I don't know why but I do.
- However if you want to loop over an indeterminate-size list of URLs to find out when each page last changed, it seemed hard -- until I remembered tail recursion, which is pretty simple -- but I don't see many people talking about it. So I thought I'd write it up.
- #### Here's how it works
- 1. Arrange all the URLs in an array.
- 2. Write a routine that reads one URL.
- 3. When it completes, it recursively calls itself for the next item in the array.
- 4. When you fall off the array, return.
- <%reader ("https://dl.dropboxusercontent.com/u/36518280/misc/tailRecursionDemo.opml")%>