Hi, Please note that a convention (but it's really just one convention) could also be to name file for partB : place_partB.clj (or even place_part_b.clj since in clojure camel case notation is not the preferred way to write things, hyphens and lower cases are -> but hyphens must be replaces by underscores in package/namespace names, and in file names).
Your solution is acceptable I think (having the load at the end of the root file). You could also consider this one: ==== place.clj ======= (ns whale.achi.model.place (:load "place/partA") (:load "place/partB")) ================== ==== place/partA.clj ======= (in-ns 'whale.achi.model.place) partA ================== ==== place/partB.clj ======= (in-ns 'whale.achi.model.place) partB ================== Or, to write it like it is done for clojure.core: ==== place.clj ======= (ns whale.achi.model.place (:load "place_part_a") (:load "place_part_b")) ================== ==== place_part_a.clj ======= (in-ns 'whale.achi.model.place) partA ================== ==== place_part_b.clj ======= (in-ns 'whale.achi.model.place) partB ================== HTH, -- Laurent 2009/4/24 billh04 <h...@tulane.edu>: > > I don't think I explained my need clearly. > > I try to rephrase it. Suppose I have a source file named place.clj in > a directory named whale/achi/model like the following: > > ==== place.clj ======== > (ns whale.achi.model.place) > partA > partB > ================== > > What I want to do is to keep the same namespace but break it into two > files named place.clj as above and placeEvaluation.clj in a > subdirectory place: > > ==== place.clj ======= > (ns whale.achi.model.place > (:load "place/placeEvaluation")) > partA > ================== > > > ==== placeEvaluation.clj === > partB > ====================== > > When, I do this, I get the error message: > > java.lang.Exception: Unable to resolve symbol: -boardPlaces- in this > context (placeEvaluation.clj:19) > > since -boardPlaces- is defined in partA, but has not been loaded yet > (I suspect). > > I believe the following will work since partA is loaded before partB: > > ==== place.clj ======= > (ns whale.achi.model.place) > partA > (load "place/placeEvaluation") > ================== > > > ==== placeEvaluation.clj === > partB > ====================== > > What I am seeking is how to split a file for one namespace into > multiple files with the same namespace. > > Also, any source file that wants to use the namespace > 'whale.achi.model.place would need only 'use 'whale.achi.model.place > and would not have to worrry about placeEvaluation but get that loaded > for free. > > On Apr 23, 9:29 pm, Drew Raines <aarai...@gmail.com> wrote: >> billh04 wrote: >> > Right now I have the two files "whale.achi.model.place.clj" and >> > "whale.achi.model.placeEvaluation.clj" that make up one name space >> > "whale.achi.model.place". >> > The first file is the "root" of the namespace. >> >> I think you're confused with how Clojure looks for packages in the >> filesystem. Perhaps you want: >> >> $ find whale >> whale/achi/model/place.clj >> whale/achi/model/place/evaluation.clj >> $ head -2 whale/achi/model/place.clj >> (ns whale.achi.model.place >> (:require [whale.achi.model.place.evaluation :as eval])) >> $ head -1 whale/achi/model/place/evaluation.clj >> (ns whale.achi.model.place.evaluation) >> >> -Drew > > > --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---