You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
I've implemented some of it. Currently supports only namespace functions. I don't think is ready but it should be enough for testing/education. You could clone it from here. (commit)
Example:
namespace NSMain;
function incrementRecursive(n: Int, max: Int): Int {
_debug(n);
return n < max ? rec incrementRecursive(n + 1, max): n;
}
entrypoint function main(): Bool {
var test = incrementRecursive(1, 99999999);
return true;
}
I'm surprised to see rec, if needed at all, on the reference rather than the declaration.
Although function rec f( ... ) ... was a common idea, it seems that practice involves function recursiveness being the default with regard to static name resolution within lexical structure. That seems to be the approach with SML, and it tends to be more natural. It does require some trickery when the inner call is intended to be to an outer declaration, not the current one.
The additional case of mutual recursion has to be handled a different way.
There also needs to be something else for anonymous function definitions.
I should zip my lip until I look more closely at the Bosque definition material.
Also, I thought this notion is independent of the question of tail recursion. Am I mistaken?
Implement the
rec
keyword and support. I would like to do CPS conversion so we always have a bounded stack.The text was updated successfully, but these errors were encountered: