3 ms·
As it happens, I've actually grown to like Clojure's recur more than tailcalls. And I much loved tailcalls over imperative loops earlier. recur is still functi
by yason 16y ago
As it happens, I've actually grown to like Clojure's recur more than tailcalls. And I much loved tailcalls over imperative loops earlier.
recur is still functional, it resembles a loop but isn't one so nothing is mutated, and you can even nest them. And you can recur over a loop or the function itself. Handy.
- _delirium 16y agoThat's fairly common style in Scheme as well, fwiw; a "named let" is very similar to Clojure's recur, and some programmers prefer it over tailcalls, at least for many common recursion/iteration patterns.