On Jun 30, 2010, at 4:09 AM, Paul Moore wrote:

Based on this comment, maybe I could ask an alternative question - can
you suggest where I should go to read some tutorials which would give
me a fast start on "just enough" Java infrastructure to get
comfortable in Clojure? Most of the Java tutorials I've seen tend to
assume I want to learn Java - I know enough Java to read code samples,
and that'll do for what I want.

Off the top of my head, the only "must have" piece of knowledge is how namespaces and source files relate to the classpath, which is described here:

http://clojure.org/libs

If you're not clear on what the classpath is: in rough terms, it's the same as PATH or PYTHONPATH, but can include .jar and .zip files as additional search roots, and all JVM resources are loaded from it. Classes (and namespaces) are loaded using a path corresponding to their full name, with each name segment corresponding to a path segment.

In short, put all your source files in directories corresponding to their namespace segments within a 'src' directory, make sure that 'src' directory is on your classpath (java -cp src:clojure.jar clojure.main, for example), and you're good to go; require and use will work as they should.

Beyond that, you need to know about the underlying host to the extent that you use its facilities and libraries. In that arena, the basics are:

(.methodName instance arg1 arg2 ...)
(ClassName/staticMethodName arg1 arg2 ...)
(ClassName. ctor-arg1 ctor-arg2 ...)

Other handy (and sometimes necessary, depending on what specific libraries, etc you're using) bits are described here:

http://clojure.org/java_interop

Cheers,

- Chas

--
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

Reply via email to