10 Clojure: a different view of programming

 

This chapter covers

  • Clojure’s concept of identity and state
  • The Clojure REPL
  • Clojure syntax, data structures, and sequences
  • Clojure interoperability with Java
  • Clojure macros

Clojure is a very different style of language from Java and the other languages we’ve studied so far. Clojure is a JVM reboot of one of the oldest programming languages — Lisp. If you’re not familiar with Lisp, don’t worry. We’ll teach you everything you need to know about the Lisp family of languages to get you started with Clojure.

[Note]  Note

Because Clojure is such a very different language, it might help to have an additional, Clojure-specific resource to consult while reading this chapter. A couple of excellent books are Clojure in Action (Manning, 2011. https://livebook.manning.com/book/clojure-in-action) and The Joy of Clojure (Manning, 2014. https://livebook.manning.com/book/the-joy-of-clojure-second-edition.

In addition to its heritage of powerful programming techniques from classic Lisp, Clojure adds amazing cutting-edge technology that’s very relevant to the modern Java developer. This combination makes Clojure a standout language on the JVM and an attractive choice for application development.

Particular examples of Clojure’s new tech are its concurrency toolkits (which we will meet in Chapter 16) and data structures (which we will introduce here and expand on in Chapter 15).

10.1 Introducing Clojure

10.1.1 Hello World in Clojure

10.1.2 Getting started with the REPL

10.1.3 Making a mistake

10.1.4 Learning to love the brackets

10.2 Looking for Clojure: syntax and semantics

10.2.1 Special forms bootcamp

10.2.2 Lists, vectors, maps, and sets

10.2.3 Arithmetic, equality, and other operations

10.2.4 Working with functions in Clojure

10.2.5 Loops in Clojure

10.2.6 Reader macros and dispatch

10.3 Functional programming and closures

sitemap