I've a clojure program in which two function recursively call each other:
(defn f1
...
(f2 ...)
)
(defn f2
...
(f1 ...)
)
The compiler is giving an error in f1
. It's saying that f2 isn't defined. Is there a way to declare
a function in clojure. I can verify that the recursion actually terminates.
there is also a
letfn
form for (possibly) mutually recursive functions:update if you then need these functions globally, you can always use
def
insideletfn
. As for me i find this approach to be a bit cleaner, thandeclare
(especially for mutually recursive ones):