r/programming • • Jun 30 '15

Clojure 1.7 is now available

http://blog.cognitect.com/blog/2015/6/30/clojure-17
75 Upvotes

14 comments sorted by

10

u/fizixer Jun 30 '15

I'm interested in learning Clojure, as a C/C++ programmer:

  • How much of Java (the language) would I need to know to be a good Clojure programmer?

  • Do Clojure programmers consult Java documentation for APIs/libraries or do they have the equivalent docs for Clojure?

  • Do I have to deal with Oracle BS for JVM (licensing etc) or do I get to stay open-source and Oracle-free?

13

u/jetRink Jun 30 '15
  • I've used Clojure for several projects and I don't know Java. People have written wrappers for pretty much all the major libraries, so I've never needed to interact with it. I'm sure it's necessary if you want to master Clojure, but you can go a long way without it.

  • Clojure has great documentation and I've never needed to consult Java documentation.

  • I use OpenJDK

2

u/fizixer Jun 30 '15

Thanks. I guess I should give it a try.

9

u/yogthos Jun 30 '15

I wrote a getting started guide a little while back, might be helpful. :) A couple of other resources I highly recommend are Clojure by example and Clojure for the brave and true.

3

u/m_nutty Jul 01 '15

I suggest you read this first: http://clojure.org/rationale i.e. things like "Write Java in Java, consume and extend Java from Clojure."

6

u/dangerbird2 Jun 30 '15

Not an expert, but here are some of my early observations

How much of Java (the language) would I need to know to be a good Clojure programmer?

Clojure has a fairly good ecosystem of idiomatic libraries available. Unless you are interfacing with Java libraries, you really don't need to know any Java. Clojure uses a functional coding style with much more in common with Scheme or Haskell than Java's objet oriented design. Understanding of the Java dev environment does make things easier.

Do Clojure programmers consult Java documentation for APIs/libraries or do they have the equivalent docs for Clojure?

It depends on what libraries you are using. Clojure's basic data types (lists, vectors, maps, etc) are all purpose-designed for the clojure standard library and can be found on clojuredocs. Like python's help, Clojure provides a doc function that can print out a construct's doc-string on the repl:

user=> (doc +)
-------------------------
clojure.core/+
([] [x] [x y] [x y & more])
  Returns the sum of nums. (+) returns 0. Does not auto-promote
  longs, will throw on overflow. See also: +'
nil

Do I have to deal with Oracle BS for JVM (licensing etc) or do I get to stay open-source and Oracle-free?

OpenJDK is open-source and copyleft(a modified GPL). From what I understand, clojure does work with it.

6

u/jschm Jun 30 '15

I recommend http://clojuredocs.org/ as the source for Clojure documentation. It has search and plenty of examples, in contrast to the official documentation.

2

u/[deleted] Jul 01 '15

I occasionally consult java docs around file IO, even though clojure has wrapped most of this in clojure.io it is beneficial to understand the terminology, if you worked with file IO other than slurping or spitting whole files in other languages though the concepts should be largely familiar.

I have done and continue to run production systems on openjdk, simple apt-get/yum install largely, although eventually at scale you may want to become more familiar with jvm parameters etc..

Dont let these concerns roadblock you at this stage, go for it.. I never regretted the time invested in clojure even though I am primarily working in a different language/stack - ocaml - in my current environment.

Freenode #clojure can be helpful when beginning too..

1

u/hu6Bi5To Jul 01 '15

I'm interested in learning Clojure, as a C/C++ programmer: How much of Java (the language) would I need to know to be a good Clojure programmer?

Not much, but it can help. There are certain parts of Clojure that are just Java objects (e.g. strings), so awareness of these things can help.

Java is also the default "cheat" language around performance obstacles, in a similar way that C is the "cheat" language for Python and Ruby. This can mean writing code in Java to call from Clojure, or it can mean using parts of the Java standard library directly in Clojure; for example the partition-by function uses a java.util.ArrayList internally (it's not exposed to any other code) because it's faster: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L6867-L6908

Do Clojure programmers consult Java documentation for APIs/libraries or do they have the equivalent docs for Clojure?

Both.

Do I have to deal with Oracle BS for JVM (licensing etc) or do I get to stay open-source and Oracle-free?

You need a Java runtime as per any other Java app, there's nothing Clojure specific.

0

u/zerexim Jul 01 '15

A question: Is Clojure relevant at all? I mean, isn't it the case of vocal minority? Actually, quite extreme minority in this case - Clojure isn't even in Top 50 of TIOBE index: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html

6

u/ponzao Jul 01 '15

Probably depends where you are located. I am originally from Finland and a lot of companies use Clojure, pretty easy to find one where it is actively used. Here in London there are quite a few companies using it (including mine), but based on a gut feel seems that fewer than back home, at least percentage-wise.

1

u/wot-teh-phuck Jul 01 '15

Would you be able to list the companies using Clojure in London (of course without disclosing which one you work for :)) ?

1

u/ponzao Jul 01 '15

Some of these might not be strictly London-based, but here goes: JUXT, uSwitch, SwiftKey, MailOnline (I don't work for them), Theorem Technology, Mastodon C.

In general this is a pretty good list: http://clojure.org/Companies

2

u/sveri Jul 01 '15

From the top of my head I read that Amazon started to use clojure for some backend stuff as well as Netflix, to name two big players in the IT world. Apart from that you might want to look at: http://clojure.org/Companies and: http://dev.clojure.org/display/community/Clojure+Success+Stories Also I remember a brazilian bank being built on the clojure / datomic stack.

Plus an uncountable anonymous mass of middle to small offices that evaluate / use clojure for smaller projects.

I am not sure if that counts as momentum yet, but, as with every other "new" language, only time will tell.