-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
idea: recur clause #34
Comments
As an aside, you might be interested in the recent tail-call optimization that was made on master: https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=29c7f8c915c3889dfd5b25878aa0692f826cd38f It's used by the recently added Mail discussion on |
I'm still not sure how to make something that uses the return value without adding another I'm just collecting the thought here.
|
This is not a concrete idea. But it has been on my mind and I think would be useful so I wanted to explain it as best as I can.
The idea is to have a
recur
clause which can trigger a the current loopy loop, overwriting any variables declared.A recur clause would take in a set of bindings. Basically
recur
would execute the same loopy loop, but with those bindings instead.I think that first of all this looks really cool. But in all seriousness, this could addresses the problem that sometimes you want to use recursion, but you want to do something to the result of the recursion. Normally, you'd have to wrap the recursive function in another function in that case because otherwise any post manipulation would recurse as well. This is why I think
cl-labels
partly was created. Also, perhaps it is possible forloopy
to recure more efficiently than with function calls. I got some inspiration for this by looking at the package recur. Which, now that I mention it, could be a useful for #16 because it showcases "code-walking" which is what would be needed for arbitrarily nested clauses.The text was updated successfully, but these errors were encountered: