tags:

views:

1920

answers:

6

Ok, so I'm psyched about another list. I got myself a copy of the beta Clojure programming book...

And the one thing I'm noticing most is that it's assumed I know... like all the major java classes.

Except, generally, I don't really care about Java. I just want enough knowledge of it for Clojure to be an option for me.

Any suggestion as to how to learn just what I need of it all?

A: 

If you're not interested in all the Java aspects of Clojure, perhaps you'd be better off learning another dialect of Lisp, such as Common Lisp or Scheme. Clojure is designed to interoperate well in the Java environment.

Greg Hewgill
I know both of those, and have opinions, both good and bad, in those regards. Are you suggesting that the only way I can learn Clojure is coming into the game with a strong understanding of Java or learning Java first?
Ok, I didn't know whether you were familiar with other Lisp options. What I'm suggesting is that coming from an existing Lisp background, Clojure won't give you much new if you aren't interested in the Java interoperability features. Perhaps you could explain more about what you're looking for.
Greg Hewgill
I'm looking for a robust, standardized, platform-independent Lisp. Common Lisp just sucks for Windows compilers unless you blow money on the top stuff. Scheme lacks a strong enough standardization, with minimalism being a weakness for it.
Got it. I'm working on such an implementation something like that right now, in fact. It's implemented in Python and integrates with the Python ecosystem. See here for more info: http://hewgill.com/journal/entries/469-on-the-lisp-family-of-languages and feel free to contact me if you're interested.
Greg Hewgill
I'll definitely check that out. I have worked a lot in IronPython, and I can say that Python is a fun little language.
There is Armed Bear Common Lisp (ABCL) which runs on top of the JVM: http://common-lisp.net/project/armedbear/
David
+1  A: 

You should be able to pick up what you need fine through Google and StackOverflow, but expect to be visiting both until you get a good feel for Java's standard libraries.

Like Greg said though, Clojure is built to be with Java, and unless you want to really get into Clojure's software transactional memory system, I'd say to check out a different Lisp. Java is certainly not required, but it's a huge leg up not to have to learn the standard libraries on top of Clojure's standard libraries.

Chris Bunch
+7  A: 

No offense to Greg, but I disagree. Learning Clojure is a perfect chance to get a bit of a grasp on the Java world as well. I have never programed in Java a day in my life and I'm learning Clojure and loving every minute of it. Of course I don't know all of the classes, but I fail to see where the book assumes you know them all. Either way, Java is not a requirement to learn Clojure.

Rayne
+12  A: 

My main recommendation for you, you've already accomplished by buying Programming Clojure. I've avoided and loathed Java for years and years, and (Programming) Clojure rehabilitated it enough that the language now excites me. Who'd've thought that a famously onerous system would let you interactively (map #(.getName %) (.getMethods (class ""))) ? Look through "Working with Java, 3.5 Adding Ant Projects and Tasks to Lancet" for an exploration in a style that I'm familiar with from Ruby.

If you're in Freenode #clojure , also join ##java. Get Java's API documentation and keep it handy. Search the web for a Java answer to something you want to do and translate it more or less directly to Clojure.

EDIT: At clj:

user=> (use 'clojure.contrib.javadoc)
nil
user=> (keys (ns-publics 'clojure.contrib.javadoc))
(*remote-javadocs* javadoc find-javadoc-url add-remote-javadoc
*core-java-api* add-local-javadoc *local-javadocs*)
user=> (javadoc "this is a java.lang.String")
true  (browses to http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html)
user=> (javadoc java.net.ServerSocket)
true  (...)
user=>
ayrnieu
A: 

As Greg above points out, languages like Clojure and Groovy target the JVM for one main reason, so that Java developers can have the best of both worlds. So, if you want to learn Lisp, Scheme or Common Lisp would be a great start!

Amit
As I replied above, I already know Common Lisp and Scheme. I have complaints about the level of consolidation and quality of free compilers. Clojure compiles to JVM which, in some cases, is far superior for code release... I've started trying to learn Java recently.
+11  A: 

Umm, actually, though Clojure was developed with Java developers considered, it was not written for Java programmers.

Clojure is designed to interoperate well in the Java environment.

Although it does, this is not what it was designed for (at least not in language part of the "Java environment"). And "Java environment" implies that the language and JVM are interconnected in some way that makes them one. They are not. Conjure is a native JVM language (unlike Jython or JRuby), and it uses a very well-built virtual machine to live within.

Like Greg said though, Clojure is built to be with Java, and unless you want to really get into Clojure's software transactional memory system, I'd say to check out a different Lisp.

Nope, sorry. Clojure was not "build to be with Java". It was built for the JVM. You can use Java libraries if you like, but it isn't required (though it is useful). And as far as the advice to use a different Lisp if you don't want to learn Java. That's ridiculous. Clojure isn't meant to be Java; it is meant to be a 1st-class Lisp. And one, by the way, that means to enhance Lisp in certain ways, to make it more modern and functional. It's ability to work well with Java should be considered a bonus, not a liability.

As Greg above points out, languages like Clojure and Groovy target the JVM for one main reason, so that Java developers can have the best of both worlds.

Also wrong. For reasons stated above. They were not written for Java developers. Sorry to be so blunt here, but I haven't seen one educated post on Clojure in these replies,and I just learned about Clojure today! It is just frustrating to see this kind of harmful advice so easily given.

I will just end with a quote by Rick Hickey (the guy who wrote Clojure):

"You can hate Java and like the JVM."

He goes on to say that that is where he stands.