wirrbel
wirrbel

Reputation: 3299

Forward declaration of a function in Clojurescript

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.

Upvotes: 2

Views: 1097

Answers (1)

wirrbel
wirrbel

Reputation: 3299

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

Upvotes: 6

Related Questions