I am trying to get the hang of CPS and was wondering if anyone could walk me through converting this example function:
function recur(n) {
if (n == 0) {
return 1;
} else {
return n * recur(n-1);
}
}
I know that the beginning goes
function recur(n,cc){
if(n==0){
cc(1);
} else{
....
}
}
but im not sure how to do the recursive call. any help would be super appreciated