Is it possible in Clojure to define a recursive function inside a let
form or should a letfn
be used instead? For instance, can I do the below using let
?
(defn blowStackExample []
(letfn [(blowStack []
(blowStack))]
(blowStackExample)))
The way you can do it is by naming the anonymous function inside the fn
form:
(defn blow-up-stack-example []
(let [blow-up-stack (fn a [] (a))]
(blow-up-stack)))
(blow-up-stack-example)