Rich Hickey gave a talk entitled "An Introduction For Java Programmers". Audio and slides are available in two parts on the Clojure blip.tv channel. Good "Clojure Scripting" tutorial here covers many basics of Clojure, as well as its Java integration (for example, using ImageJ from Clojure).

The main site's Java Interop reference shows how you can call your Java code from Clojure. But because Clojure is implemented as a Java class library, you can also easily embed Clojure in your Java applications, load code, and call functions.

Repl.java and Script.java in the distribution are the canonical examples for loading code from a user or from a file. In this section we'll show how to use the same underlying machinery to load code and then manipulate it directly from Java.

Here's a script that defines a simple Clojure function.

; foo.clj(nsuser)(defnfoo[ab](stra" "b))

And here's a Java class that loads the script, calls the foo function with some Java objects as arguments, and prints the returned object.

// Foo.javaimportclojure.lang.RT;importclojure.lang.Var;publicclassFoo{publicstaticvoidmain(String[]args)throwsException{// Load the Clojure script -- as a side effect this initializes the runtime.RT.loadResourceScript("foo.clj");// Get a reference to the foo function.Varfoo=RT.var("user","foo");// Call it!Objectresult=foo.invoke("Hi","there");System.out.println(result);}}

Compile this and run it to see the printed result:

>javac -cp clojure.jar Foo.java
>java -cp clojure.jar Foo
Hi there
>

When Calling code from outside the classpath, the same effect can be achieved by running

clojure.lang.Compiler.loadFile("foo.clj");

From within the Java code instead of RT.loadResourceScript("foo.clj");

I don't think SICP is a book about a programming language. It's a book about programming. It uses Scheme because Scheme is in many ways an atomic programming language. Lambda calculus + Tail Call Optimization (TCO) for loops + Continuations for control abstraction + syntactic abstraction (macros) + mutable state for when you need it. It is very small. It is sufficient.

Clojure is not an atomic programming language. I'm too tired/old/lazy to program with atoms. Clojure provides production implementations of generic dispatch, associative maps, metadata, concurrency infrastructure, persistent data structures, lazy seqs, polymorphic libraries etc etc. Much better implementations of some of the things you would be building by following along with SICP are in Clojure already.

So the value in SICP would be in helping you understand programming concepts. If you already understand the concepts, Clojure lets you get on with writing interesting and robust programs much more quickly, IMO. And I don't think the core of Clojure is appreciably bigger than Scheme's. What do Schemers think?

I think the Lisps prior to Clojure lead you towards a good path with functional programming and lists, only to leave you high and dry when it comes to the suite of data structures you need to write real programs, such data structures, when provided, being mutable and imperative. Prior Lisps were also designed before pervasive in-process concurrency, and before the value of high-performance polymorphic dispatch (e.g. virtual functions) as library infrastructure was well understood. Their libraries have decidedly limited polymorphism.

Stuart Halloway's book Programming Clojure is now available as an e-book (in Beta) and will come out on paper soon. Of course to the extent Schemes go beyond the standard to provide more complete functionality (as most do), there are no books on that either. Just docs in both cases.

Learning Scheme or Common Lisp on your way to Clojure is fine. There will be specifics that don't translate (from Scheme - no TCO, false/ nil/() differences, no continuations; from CL - Lisp-1, symbol/var dichotomy). But I personally don't think SICP will help you much with Clojure. YMMV.

The table below lists some of the Common Lisp entities (functions, macros etc.) and their (somewhat) equivalent Clojure entities. Note that some of the concepts may not be an exact match. For the exact behavior of the Clojure entities it is recommended that the reader see the Clojure Reference Documentation available at the Clojure home page. Note that some of these differences may be because Clojure has its heritage in Lisp-1 and not Lisp-2.

The Clojure reference also documents common differences to lisps here.

Common Lisp Feature

Clojure Equivalent

load

load-file

make-array or #(N N N N)

vector or [N N N N]

#| |# (multiline comment)

(comment ...)

documentation

doc, find-doc, javadoc

in-package

in-ns

defstruct

defstruct and create-struct (defrecord or deftype are preferred in 1.3)

The test-is framework by Stuart Sierra is included in clojure.contrib. It allows
you to tag your function definitions with assertions declared by the "is" macro as
shown in this example (from the code):

Fact is a unit testing library by James Reeves styled after systems such as
Ruby's RSpec. Using this approach, you write your tests as "facts" each
with an assertion which should demonstrate that fact:

(main) is always executed when the script is called from the command-line, even when called with no arguments.

(main) is not executed when command-line-args is used or required by another clojure file.

This method is inspired by this method of emacs scripting and works for the same reasons.

A recent update to Clojure made #! a to-end-of-line comment. Using revision 1106 or later shebang scripting can be done as normal if you have created a clj script, such as those described in Getting started:

#! /usr/bin/env clj
(println "Hello World!")

Otherwise, you can reference java the jar directly, like so:

#! /usr/bin/java -jar clojure.jar clojure.lang.Script

Note: this may not work on all systems, since on some systems only one argument is allowed!

On Windows, a similar approach works for embedding a Clojure script into a batch file:

Here, the first line is seen as a label (because of the initial colon) by cmd.exe, and as a bare keyword followed by the start of a multi-line comment by Clojure. The next lines (to the closing parenthesis) run Java with an appropriate classpath, passing the batch file name ("%~f0") and the command line arguments ("%*") and then exit the batch file (goto eof). The closing parenthesis then terminates the Clojure comment, and Clojure interprets the rest of the file.