I rarely run into this. The few times I have, I just do
(def g) ;creates a var g that is unbound
(defn f []
(g)) ;ok
(defn g [] ;f will call this
nil)
as shown by Rich at
http://markmail.org/message/vuzvdr4xyxx53hwr#query:+page:1+mid:tzsd3k6tvvc4ahoq+state:results
On Fri, Aug 13, 2010 at 11:49 PM, Eric Lavigne <[email protected]> wrote:
> Suppose I have two functions in the same file, and one depends on the other:
>
> (defn foo [x] (+ 1 x))
> (defn bar [x] (* 2 (foo x)))
>
> I can't switch their order without adding extra forward-declaration
> code, which is redundant:
>
> (declare foo)
> (defn bar [x] (* 2 (foo x)))
> (defn foo [x] (+ 1 x))
>
--
Omnem crede diem tibi diluxisse supremum.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en