Stuart Halloway, "Programming Clojure", 2009
So I might share my thoughts on this book and on the language.
For me still Clojure is more attractive then Scala because:
1. It's the toughest edge for your brain.
2. No variables and immutable data means no side effects
Hence it's not so easy to write Clojure code with much side effects.
3. Clojure has the strong concurrency concepts - if you really need mutable data - using STM (Software Transactional Memory) / MVCC, Agents, Atoms, giving you ACID Transactions without the "D" (which is only valid for databases).
4. The Java integration is really smart. Have a look:
simply generates an object you can easily use to work with.
5. Clojure is indeed fast because it generates pure Java byte code.
And of course all the other stuff that a hot language must have:
- Closures (I still can not believe that they are still discussion this hot feature for Java... it's a shame)
- List Comprehensions
- a workaround for tail recursion and currying and other weird stuff as
- very lazy sequences, trampolining, etc.
- An "if" See an example (if (> num 100) "yes" "no"))
- A "do" which is an iteration of statements - introducing side effects - and thus discouraged in clojure
- And a "loop/recure" that can be used to build everything you need in flow control (Stuart Halloway calls it the Swiss army knife).
The language itself has two downsides for me:
What do you think?
And finally have a look at this nice language comparison: Java.next
Make a list. For every topic give points from 0 to 3. What is the most elegant for you?