Programming Clojure

( 2 )

Overview

Clojure is a dynamic language for the Java Virtual Machine with a compelling combination of features:

Clojure is elegant. Clojure's clean, careful design lets you write programs that get right to the essence of a problem, without a lot of clutter and extra ceremony.

Clojure is Lisp reloaded. Clojure has the power inherent in Lisp but is not constrained by the history of Lisp.

Clojure is functional. Data ...

See more details below
Paperback (Second Edition)
$33.26
BN.com price
(Save 4%)$35.00 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (10) from $25.77   
  • New (7) from $25.77   
  • Used (3) from $28.98   
Sending request ...

Overview

Clojure is a dynamic language for the Java Virtual Machine with a compelling combination of features:

Clojure is elegant. Clojure's clean, careful design lets you write programs that get right to the essence of a problem, without a lot of clutter and extra ceremony.

Clojure is Lisp reloaded. Clojure has the power inherent in Lisp but is not constrained by the history of Lisp.

Clojure is functional. Data structures are immutable, and functions tend to be free from side effects-it's easier to write correct code and simpler to compose large programs from smaller ones.

Clojure is concurrent. Rather than error-prone locking, Clojure provides software transactional memory.

Clojure embraces Java. Calling from Clojure to Java is direct and goes through no translation layer.

Clojure is fast. Wherever you need it, Clojure gives you the same great performance that you could get from handwritten Java code.

Many languages offer some of these features, but the combination of them all makes Clojure sparkle. Programming Clojure shows you how to use them to the fullest and how you can use Clojure to build powerful programs quickly.

Read More Show Less

Editorial Reviews

From the Publisher
"Clojure is one of the most interesting languages out there right now, and the best way of learning Clojure just got better. The second edition of “Programming Clojure” adds up-to-date information, plenty of practical examples, and a ton of useful tips on how to learn, work with, and succeed with Clojure."

—Ola Bini, Creator of Ioke language, developer, ThoughtWorks

"The authors have charted the smoothest path yet to Clojure fluency with this well-organized and easy-to-read book. They have a knack for creating simple and effective examples that demonstrate how the language’s unique features fit together."
—Chris Houser Primary Clojure contributor and library author

"Clojure is a beautiful, elegant, and very powerful language on the JVM. It’s like a cathedral: you could wander into it, but you’d prefer the company of a knowledgeable guide who can give you their perspective, to help you grasp and appreciate the architecture and the art. In this book you can enjoy and benefit from the company of not one, but two seasoned developers who have the depth of knowledge and the perspective you need."
—Dr. Venkat Subramaniam, Award-winning author and founder of Agile Developer, Inc.

Read More Show Less

Product Details

  • ISBN-13: 9781934356869
  • Publisher: Pragmatic Programmers, LLC, The
  • Publication date: 4/17/2012
  • Edition description: Second Edition
  • Edition number: 2
  • Pages: 296
  • Sales rank: 259,802
  • Product dimensions: 7.40 (w) x 8.90 (h) x 1.00 (d)

Meet the Author

Stuart Halloway is a member of Clojure/core and CTO at Relevance, where he spends his time on secret projects for world domination, and watching Phineas and Ferb.

Aaron Bedra is a member of Clojure/core and a developer at Relevance, Inc. where he spends his time as a tech lead, speaker and author. He is a frequent contributor to the Clojure language and its supporting libraries as well as an active member of the Clojure community. Aaron has led the development of several commercial Clojure projects.

Read More Show Less

Table of Contents

Foreword xi

Acknowledgments xiii

Preface xv

Who This Book Is For xvi

What Is in This Book xvi

How to Read This Book xvii

Notation Conventions xix

Web Resources and Feedback xx

Downloading Sample Code xxi

1 Getting Started 1

1.1 Why Clojure? 1

1.2 Clojure Coding Quick Start 10

1.3 Exploring Clojure Libraries 17

1.4 Introducing Lancet 22

1.5 Wrapping Up 24

2 Exploring Clojure 25

2.1 Forms 25

2.2 Reader Macros 35

2.3 Functions 36

2.4 Vars, Bindings, and Namespaces 40

2.5 Flow Control 47

2.6 Where's My for Loop? 50

2.7 Metadata 54

2.8 Wrapping Up 57

3 Working with Java 59

3.1 Calling Java 60

3.2 Optimizing for Performance 68

3.3 Creating and Compiling Java Classes in Clojure 74

3.4 Exception Handling 81

3.5 Adding Ant Projects and Tasks to Lancet 85

3.6 Wrapping Up 90

4 Unifying Data with Sequences 91

4.1 Everything Is a Sequence 92

4.2 Using the Sequence Library 97

4.3 Lazy and Infinite Sequences 105

4.4 Clojure Makes Java Seq-able 107

4.5 Calling Structure-Specific Functions 113

4.6 Adding Properties to Lancet Tasks 121

4.7 Wrapping Up 126

5 Functional Programming 127

5.1 Functional Programming Concepts 128

5.2 How to Be Lazy 132

5.3 Lazier Than Lazy 140

5.4 Recursion Revisited 147

5.5 Wrapping Up 156

6 Concurrency 157

6.1 The Problem with Locks 158

6.2 Refs and Software Transactional Memory 159

6.3 Use Atoms for Uncoordinated, Synchronous Updates 166

6.4 Use Agents for Asynchronous Updates 167

6.5 Managing Per-Thread State with Vars 172

6.6 A Clojure Snake 176

6.7 Making Lancet Targets Run Only Once 187

6.8 Wrapping Up 190

7 Macros 191

7.1 When to Use Macros 191

7.2 Writing aControl Flow Macro 192

7.3 Making Macros Simpler 198

7.4 Taxonomy of Macros 204

7.5 Making a Lancet DSL 213

7.6 Wrapping Up 223

8 Multimethods 225

8.1 Living Without Multimethods 226

8.2 Defining Multimethods 228

8.3 Moving Beyond Simple Dispatch 230

8.4 Creating Ad Hoc Taxonomies 232

8.5 When Should I Use Multimethods? 236

8.6 Adding Type Coercions to Lancet 240

8.7 Wrapping Up 245

9 Clojure in the Wild 247

9.1 Automating Tests 248

9.2 Data Access 252

9.3 Web Development 257

9.4 Farewell 265

A Editor Support 267

B Bibliography 269

Index 271

Read More Show Less

Customer Reviews

Average Rating 4.5
( 2 )
Rating Distribution

5 Star

(1)

4 Star

(1)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 2 Customer Reviews
  • Posted May 15, 2010

    Worth Every Penny

    I've tried to learn Clojure a few times using online tutorials and blog posts. If, like me, you're from a background other than Java, Lisp, or Functional Programming (any of which might give you a jump start on learning the Clojure language), bits and pieces of information online aren't enough to immerse you in the language and its paradigms.

    Programming Clojure is a perfectly structured introduction to the world of Clojure and strikes a balance between explaining general Functional Programming concepts, Lisp syntax, and general usage of the Clojure language itself. Mr. Holloway litters throughout the book plenty of real-world example code to bridge the gap between theoretical and the actual.

    For me, this book nailed its audience with uncanny accuracy. If you're coming from an imperative, object-oriented programming background, this book is perfect for diving into the world of functional style and limited "side effects."

    The language is growing and changing on a daily basis. My only complaint of this book is that it doesn't seem to indicate which version of Clojure it covers, and doesn't tackle "futures" and "promises" which suggests it's a 1.0 book. I had to do some online reading to get caught up with the latest features of the language once I had completed the book.

    Still, I don't think I could have jumped into the world of Clojure without the help of this book. It was worth every penny.

    1 out of 1 people found this review helpful.

    Was this review helpful? Yes  No   Report this review
  • Posted April 5, 2013

    Clojure is a programming language that runs on the Java Virtual

    Clojure is a programming language that runs on the Java Virtual Machine. The language is called a LISP dialect - it is not a full implementation of the LISP language specification (Armed Bear Common Lisp is a full LISP implementation on the Java Virtual Machine). The creator of Clojure intentionally broke compatibility with standard LISP in an attempt to make the language simpler to learn and simpler and more practical to use in real world applications. I believe he succeeded, though I am not an expert in LISP so don't weigh my support too heavily.

    This book is not for someone completely new to writing software, and neither is it a complete reference to the Clojure language. But for someone already experienced writing software in other mainstream programming languages, it's a good introduction to Clojure.
    If you're coming to Clojure without Java experience, I do not think it is a problem. You can skip the chapter on Java interoperability and work entirely in Clojure. The project management tool Lein for Clojure takes care of working with the Java Virtual Machine for you behind the scenes, you don't need to know Java.
    On the other hand, as someone that doesn't know LISP very well, I imagine knowing LISP would make the book far easier to understand. Because Clojure's syntax is so simple - no special rules for loops, no operator precedence rules, etc... you get the basics in a hurry and then jump feet first into using advanced features. It'll take half an hour to read a chapter and than another two days playing with the example code from that chapter to really understand the concepts. I recommend the book, I learned a lot and I don't regret buying it, but I would hope there would be something a little better out there.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 2 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)