Clojure


Clojure is lisp dialect by Rich Hickey. It is a dynamic programming language with a focus on immutability and concurrency. For backend systems, it can run on the JVM and has good accessbility to the java libraries making it very practical.

Rich Hickey has a few really good philosophical talks. He explains a lot about what’s wrong with software engineering practices in general.

I’ve been trying to architect simple systems that are easy to maintain. So I’m sold on the language principles.

Learning the language has not been easy though. The syntax and concepts are different. Some good resources are-

  • Clojure blog - the initial blogs are very readable.
  • Brave Clojure - a complete free book
  • Living Clojure was the easiest book for getting started. It has lots of incremental examples. It also has a week based plan for exercises
  • Clojure In Action is also a good book. I’m trying to go through this now.

Clojure also has a different data-driven approach to designing libraries. That’s going to take some time to get used to. The book “Joy of Clojure” is about the idoimatic way of doing things. That’s another book to read in the future.

Various Concepts-

  • Parentheses and prefix notation.
  • Basic scalar types, Symbols and Keywords.
  • Lists - Function calls vs pure data.
  • Immutable persistent data structures. Sets, Vectors, Maps in addition to Lists.
  • Sequence representation and the various functions available. map/reduce.
  • Functions - Different definition styles, arity, variadic args.
  • Destructuring.
  • Flow with if, when, cond, loop/recur.
  • Metadata
  • vars and binding
  • Polymorphism
  • defmulti, defmethod
  • Java interop - Calling java and generating java classes
  • atom, ref, agents
  • futures and promises
  • Macros
  • Protocols, Records, Types
  • Unit testing
  • JDBC