Chapter 2. A whirlwind tour

 

This chapter covers

  • Getting started with Clojure programming
  • Clojure functions
  • Program flow with Clojure
  • Clojure’s core data structures

In the previous chapter, you read about some powerful features of the Clojure language. You saw some code, but it probably looked a little alien. It’s now time to set that right. This chapter and the next address the basics of writing code in Clojure. This one will walk you through the fundamentals of the structure and flow of Clojure programs. It will also give an overview of the various data structures that make up the core of the language. By the end of the next chapter, you’ll be able to read most Clojure code and write your own programs.

2.1. Getting started

The best way to learn a programming language is to write some code. Before you can do that, you need a working installation of Clojure and some familiarity with the REPL. In this section, we’ll download and install the language runtime and use the REPL to communicate with Clojure. Once you’re comfortable with the basics of using the REPL, we’ll try a slightly larger program. Finally, we’ll close this section with a few more notes about Clojure syntax as it relates to comments, whitespace, case sensitivity, and so on.

2.1.1. Installing Clojure

2.2. Program structure

2.3. Program flow

2.4. Clojure data structures

2.5. Summary