Chapter 1. Introducing Clojure

 

This chapter covers

  • Clojure as a Lisp
  • Clojure as a functional programming language
  • Clojure hosted on the Java virtual machine (JVM)
  • Key features and benefits of Clojure

Any sufficiently complicated C or Fortran program contains an ad hoc, informally specified, bug-ridden, slow implementation of half of Common Lisp.

1.1. Clojure: What and why?

Clojure is a simple and succinct programming language designed to leverage easily both legacy code and modern multicore processors. Its simplicity comes from a sparse and regular syntax. Its succinctness comes from dynamic typing and functions-as-values (that is, functional programming). It can easily use existing Java libraries because it’s hosted on the Java virtual machine. And, finally, it simplifies multithreaded programming by using immutable data structures and providing powerful concurrency constructs.

This book covers Clojure version 1.6. In the first few chapters you’ll learn the fundamentals of Clojure: its syntax, building blocks, data structures, Java interoperability, and concurrency features. As we progress beyond the basics, you’ll learn how Clojure can simplify larger programs using macros, protocols and records, and higher-order functions. By the end of this book you’ll understand why Clojure is traveling a rare path to popularity and how it can transform your approach to developing software.

1.2. Language basics

1.3. Host interoperation: A JVM crash course

1.4. Summary