5 ms·
I believe that you can replace directly recursive tail-calls with the `recur' special form to achieve an iterative function manually. If the function is truly r
by sctb 17y ago
I believe that you can replace directly recursive
tail-calls with the `recur' special form to achieve
an iterative function manually. If the function is
truly recursive, then Clojure will likely behave
much as any Scheme would.
- apgwoz 17y agoI haven't looked at the code that gets generated by `recur`, but I'm guessing it creates a trampoline, and it looks a bit limiting. (e.g. you can't recur with variadic functions) That said, probably all of the excercises in SICP could be done with `recur` and `loop,` with a few minor changes. Thanks for the tip.