On Sat, 15 May 2010 22:13:17 +0200 Peter Schuller <peter.schul...@infidyne.com> wrote: > > Which leads to the question: what's in Blah.clj? In particular, > > there's nothing in clojure that automatically run things in the script > > file; you have to explicitly invoke the main function at the end of > > the script. If you don't, then invoking it on the command line will > > just load it, and then exit without running anything. > Hmmm? I've been invoking scripts regularly since forever ;) > Back in the 1.0 days there was the clojure.Repl vs. clojure.Script > (IIRC); with 1.1 clojure.main does both things depending on > parameters. For example: > > % echo '(println "test")' > test.clj > % java -cp /usr/local/share/java/classes/clojure.jar clojure.main test.clj > test
Exactly. You explicitly invoked a function. println is an odd choice for the main function - except as an example. Compare that to: % echo '(defn my-func [& args] (apply println args))' > test.clj % java -cp ~/.clojure/clojure.jar clojure.main test.clj % Arguably, I invoked "defn", but all that did was compile a function for me - it didn't run said function. To run it, I need to invoke it explicitly at the end of the script: % echo '(my-func *command-line-args*)' >> test.clj % java -cp ~/.clojure/clojure.jar clojure.main test.clj testing (testing) % I'm thinking the problem - since the command line appears to be correct, and starts a repl if no script is provided - is that Blah.clj just defines functions, but doesn't invoke one of them. Without looking at the script, this is just a WAG, but I recall some discussion about this issue earlier. <mike -- Mike Meyer <m...@mired.org> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org -- 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