Pregunta

I would like to forward-declare a function in ClojureScript. Kind of

(defn a [] (b))
...
(defn b [] ...)

I think what kind of works is to place a (def b nil) in front of the usage (b) but I wonder if there is a "better" way.

¿Fue útil?

Solución

It seems that declare does the trick. I only found documentation on it for Clojure but it seems to work in ClojureScript as well.

http://clojuredocs.org/clojure_core/clojure.core/declare

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top