As in Clojure and functional programming we don’t have recursion, this is the resource used to treat this situation.
Why we don’t have recursion as the imperative languages?
Because one function calls another and so on. The compiler will stacking the results and calls and so you find a memory problem. To resolve this issue we have the tail recursion.
How to handle recursion ?
The compiler is smart enough to avoid stacking of these calls when using a syntax of tail recursion. In Clojure use “recur” syntax to set the call is a tail recursive.
(defn end  (print "End")) (defn counter[num] (if (= num 0) (end) (do (print num) (recur (dec num)) ) ) ) (counter 4)