Skip to main content
main-content

Über dieses Buch

Get up to speed with Clojure in this quick and practical primer. You'll learn the nuts and bolts of functional programming, data structures, sequences, destructuring, pattern matching, polymorphism, concurrency, conventions, and more. Author Mark McDonnell talks about organization with namespaces; how to change the language via macros; object-oriented programming; and creating command-line apps. Finally, he shows you how to write Clojure from shell languages and interfaces such as Vim.
After reading and using Quick Clojure, you'll come away with first-hand knowledge and advice on how to quickly adopt, use, and apply Clojure without all the theoretical baggage that bigger books can sometimes bring.
What You'll LearnWork with data structures and their syntax
Discover OOP in Clojure with patterns, polymorphisms, pattern matching, and concurrency
Use conventions, organization, and namespaces in Clojure
Create command-line apps
Build various Clojure projects with the Leiningen IDE tool and framework

Who This Book Is For
Programmers with experience. A Java background would be helpful, but not required.



Inhaltsverzeichnis

Frontmatter

Chapter 1. What Is Clojure?

Abstract
Clojure
Mark McDonnell

Chapter 2. Data Structures and Syntax

Abstract
Clojure provides a language API based upon a select set of data structures. What this means is that the syntax for certain programming functionality matches the underlying data structures.
Mark McDonnell

Chapter 3. Functional Programming

Abstract
Clojure is a functional language, so it provides certain features you would expect to find in other functional programming (FP) languages, such as the following:
Mark McDonnell

Chapter 4. Sequences

Abstract
In Clojure we have many types of collections: lists, vectors, maps, and sets. Each of these collections is also a sequence. Clojure provides an interface that is known as the sequence abstraction, and it is this abstraction that allows multiple types of built-in functions to work uniformly across these different collection types.
Mark McDonnell

Chapter 5. Functions

Abstract
Clojure
Mark McDonnell

Chapter 6. Destructuring

Abstract
In this chapter, we will be covering the concept of destructuring in Clojure.
Mark McDonnell

Chapter 7. Pattern Matching

Abstract
Pattern matching is the ability to trigger specific functionality based upon predefined patterns applied to an incoming message (or user input).
Mark McDonnell

Chapter 8. Concurrency

Abstract
One of the main selling points of Clojure as a functional language is its concurrency mechanisms (of which it has quite a few). In order to understand what concurrency means, we first need to understand the problem space it’s related to and what it means for a program to run tasks concurrently.
Mark McDonnell

Chapter 9. Namespaces

Abstract
Namespaces are a feature that allows the categorization of functions, symbols, and variables into well-defined groups. Later on in this chapter (as well as in a later chapter about using a project management tool called Leiningen
Mark McDonnell

Chapter 10. Macros

Abstract
Arguably one of the most interesting features of Clojure is its ability to provide functionality that allows the user to redefine the language and add their own features that aren’t available by default. I mean, how many times have you written some code (in whatever language, but let’s say JavaScript) and thought “I really wish I had feature X from language Y”?
Mark McDonnell

Chapter 11. Object Orientation

Abstract
One of the confusing aspects of Clojure is that although it aims at being a functional programming language, it does also provide “object-oriented” features (gasp). This is similar to other programming languages, such as Scala which also provides both FP and OOP syntax.
Mark McDonnell

Chapter 12. Leiningen

Abstract
In this chapter, I want to talk about the Clojure project-automation tool called Leiningen Up until this point, we’ve been exclusively playing around within the REPL environment (thanks to Leiningen’s lein repl feature), but we’ve reached the point now where we should be fairly confident writing Clojure code, and so we need to consider how typical Clojure projects are created, structured, and deployed, and this is where Leiningen really shines.
Mark McDonnell

Chapter 13. Command-Line Applications

Abstract
In this chapter, we’re going to do two things: first, we’re going to review Clojure’s tools.cli library in order to understand how we can utilize it to help us design and develop command-line applications. Second, we’ll look at how to package up this application in order for us to be able to distribute it.
Mark McDonnell

Backmatter

Weitere Informationen

Premium Partner