Get Programming with Clojure
Yehonathan Sharvit
  • MEAP began November 2018
  • Publication in Fall 2019 (estimated)
  • ISBN 9781617296093
  • 475 pages (estimated)
  • printed in black & white
Well-written programs are easy to understand, modify, and maintain. Clojure, a functional-first dynamic language for the Java Virtual Machine, helps you write clean code without sacrificing productivity concerns like rapid prototyping and interaction with standard Java libraries. In this thoughtful, hands-on tutorial, Clojure expert Yehonathan Sharvit helps you get programming with Clojure by engaging you in fast, fun exercises, projects, and clearly-written lessons. By the time you finish your final capstone project, you’ll be designing Clojure functions, apps, and libraries like a pro!
Table of Contents detailed table of contents

Unit 0: Get Programming with Clojure

Lesson 1 The Clojure syntax

1.1 Function calls

1.2 Arithmetic expressions

1.3 if expressions

1.4 Summary

Lesson 2 A preview of Clojure key features

2.1 Dynamically typed

2.2 Rich collection types

2.3 Functional Programming

2.3.1 Functions as arguments

2.3.2 Functions that return functions

2.3.3 Anonymous functions

2.3.4 Collection of functions

2.4 Homoiconicity

2.4.1 What is homoiconicity?

2.4.2 Why Homoiconicity is important?

2.4.3 Types of parentheses

2.5 Immutability by default

2.6 A powerful interactive development environment

2.7 JVM ecosystem

2.8 Extensibility

2.8.1 Powerful macro system

2.8.2 Macros provided by Clojure

2.8.3 Custom macros

2.9 Elegance

2.10 Portability: Clojure and Clojurescript

2.11 Summary

Lesson 3 Clojure in the industry

3.1 What kind of projects are suited for Clojure?

3.1.1 Web Servers

3.1.2 Microservices

3.1.3 Big Data

3.1.4 Complex frontend web applications

3.2 What kind of projects are not suited for Clojure?

3.2.1 Shell Scripts

3.2.2 Infrastructure projects

3.2.3 Mobile apps

3.2.4 Simple frontend web applications

3.3 Summary

Unit 1: Get familiar with Clojure syntax

Lesson 4 Arithmetic expressions

4.1 Expressions and forms

4.2 Operations with two numbers

4.3 Arithmetic Operations with more than two numbers

4.4 Nested Arithmetic Operations

4.5 Exercises

4.5.1 Ex 1:

4.5.2 Ex 2:

4.5.3 Ex 3:

4.5.4 Ex 4:

4.5.5 Ex 5:

4.5.6 Ex 6:

4.6 Summary

Lesson 5 Arithmetic comparisons

5.1 Equality check

5.2 Arithmetic comparisons

5.3 Number functions

5.4 Exercises

5.4.1 Ex 1:

5.4.2 Ex 2:

5.4.3 Ex 3:

5.4.4 Ex 4:

5.4.5 Ex 5:

5.4.6 Ex 6:

5.4.7 Ex 7:

5.4.8 Ex 8:

5.4.9 Ex 9:

5.5 Summary

Lesson 6 Logic operations

6.1 Boolean values, nil and truthiness

6.2 Logical negation: not

6.3 Logical and

6.4 Logical or

6.5 Exercises

6.5.1 Ex 1:

6.5.2 Ex 2:

6.5.3 Ex 3:

6.5.4 Ex 4:

6.5.5 Ex 5:

6.6 Summary

Lesson 7 Complex nested expressions

7.1 Visualization

7.2 Exercises

7.2.1 Ex 1:

7.2.2 Ex 2:

7.3 Summary

Unit 2: Meet the Clojure REPL

Lesson 8 Interactive development

8.1 What is a REPL?

8.2 The value of a REPL

8.3 Clojure installation

8.4 Clojure CLI usage

8.5 Clojure default REPL

8.6 Klipse REPL

8.7 Multi-line expressions

8.8 Multiple expressions at once

8.9 Invalid expressions

8.10 Exit the REPL

8.11 Alias for the Klipse REPL

8.12 Summary

Lesson 9 documentation, auto completion and history

9.1 Documentation

9.2 Auto-completion

9.3 History

9.4 Summary

Lesson 10 Capstone project: Know your REPL

10.1 Mission

Unit 3: Conditionals and Functions

Lesson 11 Naming stuff with def

11.1 def syntax

11.2 naming rules and conventions

11.3 dynamically typed language

11.4 Summary

Lesson 12 Conditional branching with if and cond

12.1 Simple if expressions

12.2 Nested if expressions

12.3 Conditional with cond

12.4 Default values with cond

12.5 Summary

Lesson 13 functions

13.1 Function definition syntax

13.2 Function arity

13.3 Pure and impure functions

13.4 Variable number of arguments

13.5 Functions return a single value

13.6 By reference or by value?

13.7 Summary

Lesson 14 Capstone project

14.1 Your mission

14.2 Guidance

14.3 Solution

14.4 Second requirement

14.5 Second requirement

14.6 Third requirement

14.7 Fourth and fifth requirement

14.8 Last requirement


Unit 4 My first Clojure program

Lesson 15 Strings conversion with str and read-string

Lesson 16 Printing to the console

Lesson 17 Running a program from the command line

Lesson 18 Capstone project: “FizzBuzz”

Unit 5 Clojure primitive types

Lesson 19 Numbers, strings, characters and booleans

Lesson 20 Keywords and symbols

Lesson 21 Regular expressions

Lesson 22 Comments

Lesson 23 nil

Lesson 24 Capstone project: A calculator that handles basic arithmetic operations or currency conversions

Unit 6 Functions again

Lesson 25 Local bindings

Lesson 26 Function documentation

Lesson 27 Capstone project: Make your calculator configurable

Unit 7 Data collections - Part 1: vectors and maps

Lesson 28 Introduction to immutable data structures

Lesson 29 Vectors

Lesson 30 Maps

Lesson 31 nil again

Lesson 32 Capstone project: A tiny book library

Unit 8 Functions as first class citizens

Lesson 33 Anonymous functions

Lesson 34 Lexical scope

Lesson 35 Functions should do one thing

Lesson 36 Capstone project: Refactor a big function into many inner functions

Unit 9 Pure functions and side effects

Lesson 37 Pure functions

Lesson 38 Stateless functions

Lesson 39 Functions with and without side effects

Lesson 40 Capstone project: FizzBuzz again

Unit 10 High order functions

Lesson 41 Functions that receive functions

Lesson 42 Composing a data manipulation pipeline

Lesson 43 filter

Lesson 44 map

Lesson 45 reduce

Lesson 46 iterating for side effects with doseq, dotimes

Lesson 47 Capstone project: Compose a string from the letters whose ascii values are odd numbers

Unit 11 Write a real Clojure program

Lesson 48 namespaces

Lesson 49 private symbols

Lesson 50 Using third party libraries

Lesson 51 Deployment

Unit 12 State Management

Lesson 52 To the immutability and beyond

Lesson 53 atoms

Lesson 54 Capstone project: bank account management

Unit 13 More ways to define functions

Lesson 55 variadic functions

Lesson 56 multi-arity functions

Lesson 57 How to design the signature of a function

Lesson 58 Capstone project: Progressive tax calculator

Unit 14 Data collections - Part 2: lists and lazy sequences

Lesson 59 Linked list: so simple but so powerful

Lesson 60 List

Lesson 61 quote a.k.a WYSIWYG

Lesson 62 Sequences

Lesson 63 Lazy sequences

Lesson 64 Infinite lazy sequences

Lesson 65 Capstone project: Implement a dictionary with lists

Unit 15 Leverage existing java code in a Clojure project

Lesson 66 Rationale: Why would you want to use java code in Clojure

Lesson 67 Classes

Lesson 68 Types

Lesson 69 importing java libraries

Lesson 70 Capstone project: Write a date parser and converter

Unit 16 Conclusion: Elegant code

Lesson 71 Destructuring

Lesson 72 Chaining function calls with thread macros

Lesson 73 when instead of if

Lesson 74 short functions

Lesson 75 passing objects with default values instead of lots of arguments

About the Technology

Clojure is a dynamic functional programming language that runs on the JVM. Based on the rock-solid Lisp language, Clojure emphasizes code clarity and maintainability through features like immutable data structures, first-class functions, and built-in concurrency. Designed with productivity in mind, Clojure goes anywhere Java goes, combining REPL-based interactive development with the efficiency of a modern high-level language. This concise, expressive, and flexible language has been embraced by industry giants like Amazon, Staples, Walmart, and Netflix, so Clojure skills are a lucrative addition to any developer’s toolbox!

About the book

Get Programming with Clojure guides you through exercises, examples, and projects that teach you to build fast, robust, applications with Clojure. Under Yehonathan Sharvit’s expert instruction, you’ll begin by getting comfortable with Clojure’s Lisp-y syntax. Then, you’ll start writing short programs that introduce functional programming principles like immutability, data-orientation, and first-class functions. After two or three small projects, you’ll be ready to drill down to more advanced concepts including logic operations, vectors and maps, lazy sequences, pure and high-order functions, and state management.

Throughout this hands-on book, you’ll work with the custom interactive Klipse Clojure REPL environment—developed by the author himself!—where you’ll quickly appreciate the productivity benefits of evaluating and modifying expressions from the command line. Capstone projects at the end of each set of short, focused lessons seal in all you’ve learned. You’ll grow your skills step-by-step as you explore building and deploying a Clojure program that handles real-life challenges like the management of a bank account. By the end of the book, you’ll be well-prepared to move on to developing ecommerce web servers, writing front-end apps, publishing your own Clojure libraries, and more!

What's inside

  • Mastering Clojure syntax
  • Working with immutable data collections
  • Functions as first-class objects
  • Evaluating expressions in the Clojure REPL environment
  • Composing a pipeline for manipulating data
  • Capstone projects ranging from a bank account manager to a string composer

About the reader

For developers with intermediate experience with a high-level programming language like Java, Python, C#, or Ruby.

About the author

Yehonathan Sharvit is a full-stack Web consultant who shares his passion for Clojure by leading Clojure workshops and speaking at conferences worldwide. He’s famous in the Clojure community for creating Klipse, a pluggable web code evaluator. Yehonathan blogs about Clojure at

Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.

placing your order...

Don't refresh or navigate away from the page.

FREE domestic shipping on three or more pBooks