Clojure is a LISP for the Java Virtual Machine (JVM). As a schemer, I wondered if I should give Clojure a go professionally. After all, I enjoy Rich Hickey's talks and even Uncle Bob is a Clojure fan. So I considered strength and weaknesses from my point of view:
Pros
- S-Expressions
- Makes functional programming easy
- Schemy naming with
?
and!
suffixes - Integrated testing framework
- Platform independence due to JVM
- Simple Java interoperability
- Clojure map type corresponds to JSON
- Web-server abstraction with extensions (Ring)
- Dedicated Ubuntu-based Docker image
Cons
- Too many core functions
- Too many concurrency concepts
- Having collection functions and the sequence API is confusing
- Keywords feels unnecessary, given symbols
- Unwieldy default project structure
- Leiningen feels forced upon you
- Clojure is not just a single jar (anymore)
- No integrated JSON parser
Insight
Clojure seems good enough. It is not flawless and somewhat overloaded, but far, far ahead of Javascript, Python, Go, or Rust. Of course, I would always prefer CHICKEN Scheme for any passion project. But in an environment that already runs databases written in Java, the JVM has street cred, and a large community hints at sustainability, Clojure presents itself as well balanced in novelty and stability. All in all, Clojure seems to be the enterprise Lisp.
Top comments (1)
Will address your cons list as a Clojure hobbyist and enthusiast:
Clojure has a long list of core functions, but most of them aren't really supper necessary, they serve just as syntactic sugars to support the writing of more concise code. Just take your time to memorize the most useful and common and pick your favorite set of core functions
That's one of the core strengths of the language. I mean, look at Common Lisp, they just give you bordeaux threads and that's it. Clojure for concurrent/networked applications feels like programming on steroids. Having said that, it's common sense among the community that atom is the powerhouse of concurrent programming in Clojure that can be used in most of the situations. STMs and agents are much less frequently used. Go blocks are very interesting and very useful in Clojurescript.
This point I didn't understand, what are "collection functions"? All collections can be handled via the protocol of sequences and that's a good thing. Instead of forcing you to use cons lists to every situation, Clojure gives you four collection types (sets/vectors/maps/lists) and they can be handled via the same protocol/interface.
They are very similar but serve different purposes, this is clearly explained in the documentation.
It takes time to get used to it indeed
This is not the case anymore, you always can choose deps.edn
That's a valid point I guess
That's a valid point but using dependencies isn't that hard in Clojure, even for a repl session (with deps.edn)