Re:Ask HN: Thinking in Functional programming
by sctb on Monday July 20, 2009 @12:35PM
(#714645)
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.
[ Parent
| on HN ]
I 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.