On Jan 29, 2009, at 8:03 AM, timc wrote:
I'm struggling to understand exactly what form(s) a Clojure program can take. In particular, the empty section "The REPL and main entry points" on the clojure.org web site doesn't help.
I'm sorry about that being empty. I'm on the hook for that and I'll get to it soon.
In the meantime, here's the doc for clojure.main/main which should allow you to launch a Clojure program from the command line or via the launching mechanism that can be configured for a jar:
Clojure user=> (doc clojure.main/main) ------------------------- clojure.main/main ([& args])Usage: java -cp clojure.jar clojure.main [init-opt*] [main-opt] [arg*]
With no options or args, runs an interactive Read-Eval-Print Loop init options: -i, --init path Load a file or resource-e, --eval string Evaluate expressions in string; print non-nil values
main options: -r, --repl Run a repl path Run a script from from a file or resource - Run a script from standard input -h, -?, --help Print this help message and exit operation: - Establishes thread-local bindings for commonly set!-able vars - Enters the user namespace- Binds *command-line-args* to a seq of strings containing command line
args that appear after any main option - Runs all init options in order - Runs a repl or script if requestedThe init options may be repeated and mixed freely, but must appear before any main option. The appearance of any eval option before running a repl
suppresses the usual repl greeting message: "Clojure". Paths may be absolute or relative in the filesystem or relative to classpath. Classpath-relative paths have prefix of @ or @/I'd recommend using ant to build a jar file containing your application. There are examples of build.xml files in the clojure top level directory and the clojure-contrib top level directory. Clojure source files should be in your classpath. You can optionally compile them to class files which will also be in your classpath.
Given that with clojure.main working this way, launching your Clojure application becomes exactly like launching a Java application, there should be a lot of information on the web that can help you the rest of the way.
--Steve
smime.p7s
Description: S/MIME cryptographic signature