Re: newbie question: splitting up source files

2010-02-06 Thread Michael Wood
P.S.: Instead of: (print (format "blah: %s\n" arg)) You could use: (printf "blah: %s\n" arg) or: (println "blah:" arg) If you want no space after the colon, you could use: (println (str "blah:" arg)) -- Michael Wood -- You received this message because you are subscribed to the Google

Re: newbie question: splitting up source files

2010-02-06 Thread Michael Wood
On 6 February 2010 00:52, Mike Jarmy wrote: > OK, here's a slightly more elaborate toy example that works.  In this > example, foo-main.clj needs foo-a.clj, and they both need > foo-util.clj.  I was expecting the (in-ns) call in foo-a to have a > ":load" keyword, just like (ns) in foo-main, but it

Re: newbie question: splitting up source files

2010-02-05 Thread Mike Jarmy
@Richard: Yes, I think that makes sense. I am running into dependency problems when I try to split up the namespace -- my split-up files have a hard time refering to each other. So I think that file-per-namespace is the answer. @Sean: yes I will probably compile the app to a jar at some point. T

Re: newbie question: splitting up source files

2010-02-05 Thread Richard Newman
It might be helpful if the documentation at http://clojure.org/namespaces mentioned how to split out a namespace into multiple files. I never split a namespace into multiple files: I split my project into multiple namespaces. That way I can simply :require and :use them from each other, and

Re: newbie question: splitting up source files

2010-02-05 Thread Sean Devlin
Personally, I don't load individual .clj file at the command line. I'll usually build a .jar & include it in my classpath. On Feb 5, 5:52 pm, Mike Jarmy wrote: > OK, here's a slightly more elaborate toy example that works.  In this > example, foo-main.clj needs foo-a.clj, and they both need > foo

Re: newbie question: splitting up source files

2010-02-05 Thread Mike Jarmy
OK, here's a slightly more elaborate toy example that works. In this example, foo-main.clj needs foo-a.clj, and they both need foo-util.clj. I was expecting the (in-ns) call in foo-a to have a ":load" keyword, just like (ns) in foo-main, but it doesn't, so I just called (load) afterwards. Anyway

Re: newbie question: splitting up source files

2010-02-05 Thread Mike Jarmy
Greg: your code works, if I go back to the original classpath. Thanks. The 2nd classpath I posted was purely out of desperation, I didn't think it was really going to work. What your code implies to me is that for each namespace, there should be one source file that is sort of the 'master' file -

Re: newbie question: splitting up source files

2010-02-05 Thread Greg
Mike, I'd say this is not your fault. I'm a clojure newbie too and the answer to your question is nowhere to be found in Clojure's barren documentation. You're using the right command line stuff, but you need to change your code: ;; foo.clj (ns foo (:load "foo-util")) (defn main [] (print "he

Re: newbie question: splitting up source files

2010-02-05 Thread Mike Jarmy
That yields ".;lib/clojure.jar", just as we'd expect. I also tried, "java -cp foo.clj;foo-util.clj;lib/clojure.jar clojure.main foo.clj", but that gave the same error. All of these classpaths work when I comment out the calls to "(require 'foo-util)" and "(frob)" -- which you would expect, since

Re: newbie question: splitting up source files

2010-02-05 Thread Meikel Brandmeyer
Hi, Am 05.02.2010 um 22:13 schrieb Sean Devlin: > This expression will provide a string that is the classpath > > ((into {} (System/getProperties)) "java.class.path") > > There's probably a more elegant way... anyone? Simply (System/getProperty "java.class.path")? Sincerely Meikel -- You r

Re: newbie question: splitting up source files

2010-02-05 Thread Sean Devlin
This expression will provide a string that is the classpath ((into {} (System/getProperties)) "java.class.path") There's probably a more elegant way... anyone? On Feb 5, 4:03 pm, Mike Jarmy wrote: > I'd like to take a stab at fixing it from the command line if I can. > I'm working on a script

Re: newbie question: splitting up source files

2010-02-05 Thread Mike Jarmy
I'd like to take a stab at fixing it from the command line if I can. I'm working on a script that I actually want to use from the command line -- the clojure part I think I have under control for now, since the script works just fine as one big file. I've got cygwin installed, and when I run env,

Re: newbie question: splitting up source files

2010-02-05 Thread Sean Devlin
You're running into a classpath issue. You'll need to have both files on you classpath. If you're just getting started, I'd suggest using Netbeans/Enclojure, as it handles the classpath stuff for you, and you can focus on learning Clojure. On Feb 5, 3:41 pm, Mike Jarmy wrote: > winXP, java 1.6

Re: newbie question: splitting up source files

2010-02-05 Thread Mike Jarmy
winXP, java 1.6 On Fri, Feb 5, 2010 at 3:31 PM, Sean Devlin wrote: > What development environment are you using? > > On Feb 5, 1:57 pm, Mike Jarmy wrote: >> I'm writing a clojure program which is getting sort of large, so I'd >> like to split it up into separate source files.  However, I'm havin

Re: newbie question: splitting up source files

2010-02-05 Thread Sean Devlin
What development environment are you using? On Feb 5, 1:57 pm, Mike Jarmy wrote: > I'm writing a clojure program which is getting sort of large, so I'd > like to split it up into separate source files.  However, I'm having > trouble figuring out how to tell the files about each other's > existenc