Get Programming with Clojure
Yehonathan Sharvit
  • MEAP began November 2018
  • Publication in Early 2021 (estimated)
  • ISBN 9781617296093
  • 475 pages (estimated)
  • printed in black & white
We regret that Manning Publications will not be publishing this title.

If you have always wanted to learn how to program using a language all the cool kids use, now is your chance!

Joe Justesen
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!

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!

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. Your first Clojure program

Lesson 15. String conversions

15.1 String concatenation with str

15.2 String manipulation

15.4 Convert data into string

15.5 Number formatting [Consider removing this section]

15.6 Converting string into data

15.7 Summary

15.8 Try it

15.9 Answers

Lesson 16. Printing and handling side effects

16.1 Side effects

16.2 Printing to the console

16.3 return value and side effects

16.4 A function made of several print expressions

16.5 Several Print inside an if expression with do

16.6 Summary

16.7 Try this

16.8 Answers

Lesson 17. Running a program from the command line

17.1 A program with no arguments

17.2 A program with string arguments

17.3 A program with non-string arguments

17.4 Summary

17.5 Try this

17.6 Answers

Lesson 18. Capstone project: A program - Who drank the most beer?

18.1 Your mission

18.2 Guidance

18.3 Solution

Unit 5 Introduction to Immutable Data collections

Lesson 19 Retrieve information from data collections

Lesson 20 Handling changes in data collections

Lesson 21 Capstone project: Github repositories

Unit 6 Functions again

Lesson 22 Functions should do one thing

Lesson 23 Local bindings

Lesson 24 Exception handling

Lesson 25 Function documentation

Lesson 26 Capstone project: Make your calculator configurable

Unit 7 Functions as first class citizens

Lesson 27 Anonymous functions (update a map)

Lesson 28 Lexical scope

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

Unit 8 Pure functions and side effects

Lesson 30 Pure functions - memoization and testing

Lesson 31 Stateless functions

Lesson 32 Functions with and without side effects

Lesson 33 Capstone project: FizzBuzz again

Unit 9 Basic Data manipulation

Lesson 34 Functions that receive functions

Lesson 35 Composing a data manipulation pipeline

Lesson 36 filter (mention lazy sequences in context, mention the common interface between all sequences)

Lesson 37 map

Unit 10 Advanced data manipulation

Lesson 38 reduce

Lesson 39 iterating for side effects with doseq, dotimes

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

Unit 11 Write a real Clojure program

Lesson 41 namespaces

Lesson 42 private symbols

Lesson 43 Comments

Lesson 44 Using third party libraries

Lesson 45 Deployment

Unit 12 State Management

Lesson 46 To the immutability and beyond

Lesson 47 atoms

Lesson 48 Capstone project: bank account management

Unit 13 More ways to define functions

Lesson 49 variadic functions

Lesson 50 multi-arity functions

Lesson 51 How to design the signature of a function

Lesson 52 Capstone project: Progressive tax calculator

Unit 14 Leverage existing java code in a Clojure project

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

Lesson 54 Classes

Lesson 55 Types

Lesson 56 importing java libraries

Lesson 57 Capstone project: Write a date parser and converter

Unit 15 Conclusion: Elegant code

Lesson 58 Destructuring

Lesson 59 Chaining function calls with thread macros

Lesson 60 when instead of if

Lesson 61 short functions

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


Appendix A: Clojure editors

Appendix B: Regular expressions

Appendix C: keywords vs. symbols

Quick Start: Your first Clojure program

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

placing your order...

Don't refresh or navigate away from the page.
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.

FREE domestic shipping on three or more pBooks