3 ms·
Sure you can, you just have to make the recursive call explicit: https://clojurebridge.github.io/community-docs/docs/clojure/recur/ https://clojurebridge.githu
by cr__ 8y ago
Sure you can, you just have to make the recursive call explicit:
https://clojurebridge.github.io/community-docs/docs/clojure/recur/ https://clojurebridge.github.io/community-docs/docs/clojure/...
This has the nice side effect of preventing you from
writing a function that you think will be tail call optimized but really isn’t—the compiler will yell if your call to `recur` isn’t in tail position.
The code in the article doesn’t have the recursive call in tail position anyway, so it’s not like other languages would be able to optimize it away.