Forms

Clojure is homoiconic,[17] which is to say that Clojure code is composed of Clojure data. When you run a Clojure program, a part of Clojure called the reader reads the text of the program in chunks called forms and translates them into Clojure data structures. Clojure then compiles and executes the data structures.

The Clojure forms covered in this book are summarized in Figure 1, Clojure forms. To see forms in action, let’s start with some simple forms supporting numeric types.

Form

Example(s)

Primary Coverage

Boolean

true, false

Booleans and nil

Character

\a

Strings and Characters

Keyword

:tag, :doc

Maps, Keywords, and Records

List

(1 2 3), (println "foo")

Chapter 3, Unifying Data with Sequences

Map

{:name "Bill", :age 42}

Maps, Keywords, ...

Get Programming Clojure, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.