I am writing several similar versions of a certain recursive function, for comparison purposes. My functions look like this:
function rec1(n) {
/* some code */
rec1(n-1);
}
Then, to create another version, I copy & paste and get:
function rec2(n) {
/* some other code */
rec2(n-1);
}
etc.
Instead of having to change the name of the function in each version, I wonder if there is some way to refer to the "current function" (just as in a Unix script it is possible to refer the the "current script" with the $0 variable), so that I can write:
function rec1(n) {
/* some code */
$this_function$(n-1);
}