Continuing this train of thought... 1. The "declare" macro may be handy for declaring multiple names at once.
2. Maybe one could use the functions in clojure.repl or clojure- contrib.ns-utils to write something that automatically forward declares everything needed? On Aug 13, 10:49 pm, Tim Daly <d...@axiom-developer.org> wrote: > Suppose you make a file containing a > (def foo) > form for every defn in every file and then load that first? > Does that solve the circular reference problem? > > Tim Daly > > > > Eric Lavigne wrote: > > The (def g) in your example has the same effect as the (declare foo) > > in my example. > > > I discussed two problems. The first problem, which you addressed, was > > mostly just a warm-up for discussing a related problem that is more > > severe. Where can I put (def g) so that two files can "require" each > > other? > > > This is not a rare problem for me. Like Mike Anderson, I work around > > it by putting extra thought into which package-level dependencies I > > will allow, which sometimes necessitates creating more or fewer > > packages than I otherwise would have created. > > > On Sat, Aug 14, 2010 at 12:13 AM, Wilson MacGyver <wmacgy...@gmail.com> > > wrote: > > >> 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:tzsd3k... > > >> On Fri, Aug 13, 2010 at 11:49 PM, Eric Lavigne <lavigne.e...@gmail.com> > >> 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 clojure@googlegroups.com > >> Note that posts from new members are moderated - please be patient with > >> your first post. > >> To unsubscribe from this group, send email to > >> clojure+unsubscr...@googlegroups.com > >> For more options, visit this group at > >>http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en