3 ms·
The use of recur in Clojure is by design. It would have been quite trivial to optimize this type of self recursion, but since it doesn't do general tail call op
by hencq 6y ago
The use of recur in Clojure is by design. It would have been quite trivial to optimize this type of self recursion, but since it doesn't do general tail call optimization, they introduced the recur keyword. See also [1]. By the way, you don't need to use loop in Clojure either, it also works with functions.
[1]. https://clojure.org/about/functional_programming#_recursive_looping https://clojure.org/about/functional_programming#_recursive_...