Programming Clojure

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Programming Clojure, 2nd Edition is a significant update to the classic book on the Clojure language. You'll get thorough coverage of all the new features of Clojure 1.3, and enjoy reorganized and rewritten chapters that reflect the significance of new Clojure concepts. Many code examples have been rewritten or replaced, and every page has been reevaluated in the light of Clojure 1.3.

As Aaron and Stu show you how to build an application from scratch, you'll get a rich view into a complete Clojure workflow. And you'll get an invaluable education in thinking in Clojure as you work out solutions to the various parts of a problem.

Clojure is becoming the language of choice for many who are moving to functional programming or dealing with the challenges of concurrency. Clojure offers:

The simplicity of an elegantly designed language

The power of Lisp

The virtues of concurrency and functional style

The reach of the JVM

The speed of hand-written Java code

It's the combination of these features that makes Clojure sparkle. Programming Clojure, 2nd Edition shows you how to think in Clojure, and to take advantage of these combined strengths to build powerful programs quickly.

What You Need:

Oracle JDK 6

A text editor

Author(s): Stuart Halloway, Aaron Bedra
Edition: Second Edition
Publisher: Pragmatic Bookshelf
Year: 2012

Language: English
Pages: 296

Cover......Page 1
Table of Contents......Page 7
Foreword for the Second Edition......Page 10
Foreword for the First Edition......Page 11
Acknowledgments......Page 12
Who This Book Is For......Page 13
What Is in This Book......Page 14
How to Read This Book......Page 15
Notation Conventions......Page 16
Downloading Sample Code......Page 18
1. Getting Started......Page 20
Why Clojure?......Page 21
Clojure Coding Quick Start......Page 30
Exploring Clojure Libraries......Page 35
Wrapping Up......Page 39
Forms......Page 40
Reader Macros......Page 49
Functions......Page 51
Vars, Bindings, and Namespaces......Page 55
Calling Java......Page 62
Flow Control......Page 64
Where's My for Loop?......Page 67
Metadata......Page 70
Wrapping Up......Page 72
3. Unifying Data with Sequences......Page 73
Everything Is a Sequence......Page 74
Using the Sequence Library......Page 78
Lazy and Infinite Sequences......Page 87
Clojure Makes Java Seq-able......Page 89
Calling Structure-Specific Functions......Page 94
Wrapping Up......Page 102
Functional Programming Concepts......Page 103
How to Be Lazy......Page 108
Lazier Than Lazy......Page 116
Recursion Revisited......Page 121
Wrapping Up......Page 130
5. State......Page 131
Concurrency, Parallelism, and Locking......Page 132
Refs and Software Transactional Memory......Page 133
Use Atoms for Uncoordinated, Synchronous Updates......Page 140
Use Agents for Asynchronous Updates......Page 141
Managing Per-Thread State with Vars......Page 145
A Clojure Snake......Page 150
Wrapping Up......Page 159
Programming to Abstractions......Page 161
Interfaces......Page 164
Protocols......Page 165
Datatypes......Page 169
Records......Page 174
reify......Page 180
Wrapping Up......Page 181
When to Use Macros......Page 182
Writing a Control Flow Macro......Page 183
Making Macros Simpler......Page 189
Taxonomy of Macros......Page 194
Wrapping Up......Page 202
Living Without Multimethods......Page 203
Defining Multimethods......Page 205
Moving Beyond Simple Dispatch......Page 208
Creating Ad Hoc Taxonomies......Page 210
When Should I Use Multimethods?......Page 214
Wrapping Up......Page 217
9. Java Down and Dirty......Page 218
Exception Handling......Page 219
Wrestling with the Integers......Page 222
Optimizing for Performance......Page 224
Creating Java Classes in Clojure......Page 229
A Real-World Example......Page 234
Wrapping Up......Page 241
10. Building an Application......Page 242
Scoring a Clojurebreaker Game......Page 243
Testing the Scorer......Page 246
test.generative......Page 250
Creating an Interface......Page 258
Deploying Your Code......Page 263
Farewell......Page 266
A1. Editor Support......Page 267
A2. Bibliography......Page 268
Index......Page 269