Paperback
-
PICK UP IN STORECheck Availability at Nearby Stores
Available within 2 business hours
Related collections and offers
Overview
The first half of the book takes you through Clojure’s unique design and lets you try your hand at two Clojure projects, including a web app. The holistic course in second half provides you with critical tools and resources, including ways to plug into the Clojure community.
- Understand the basic structure of a Clojure expression
- Learn how to shape and control code in a functional way
- Discover how Clojure handles real-world state and concurrency
- Take advantage of Java classes and learn how Clojure handles polymorphism
- Manage and use libraries in a Clojure project
- Use the core.async library for asynchronous and concurrent communication
- Explore the power of macros in Clojure programming
- Learn how to think in Clojure by following the book’s seven-week training course
Product Details
ISBN-13: | 9781491909041 |
---|---|
Publisher: | O'Reilly Media, Incorporated |
Publication date: | 05/04/2015 |
Pages: | 239 |
Product dimensions: | 6.90(w) x 9.10(h) x 0.60(d) |
About the Author
Table of Contents
Preface ix
Part I A Guided Tour of Clojure
1 The Structure of Clojure 3
Baby Steps with Simple Values 4
Put Your Clojure Data in Collections 6
Using a List Collection 6
What Can We Do with Lists? 7
Using Vectors for Collecting Data by Index 8
What Collections Have in Common 10
Maps for Storing Key-Value Pairs of Data 11
Using Sets for Unique Collections of Data 13
Summary of Simple Value and Collections 15
Lists Are the Heart of Clojure 16
Symbols and the Art of Binding 17
Creating Our Own Functions 19
Keep Your Symbols Organized in Namespaces 21
2 Flow and Functional Transformations 25
Controlling the Flow with Logic 26
Logic Tests You Can Use on Collections 29
Harnessing the Power of Flow Control 32
Functions Creating Functions and Other Neat Expressions 36
Destructuring 38
The Power of Laziness 41
Recursion 43
The Functional Shape of Data Transformations 46
Map the Ultimate 47
Reduce the Ultimate 49
Other Useful Data Shaping Expressions 50
3 State and Concurrency 55
Handling Real-World State and Concurrency 55
Using Atoms for Independent Items 55
Using Refs for Coordinated Changes 59
Using Agents to Manage Changes on Their Own 63
4 Java Interop and Polymorphism 69
Handling Interop with Java 69
Practical Polymorphism 73
5 How to Use Clojure Projects and Libraries 83
Getting Set Up with a Clojure Editor 83
Creating Our Project with Leiningen 84
Dependency Management with Leiningen 90
Using Libraries in Your Own Project 93
6 Communication with core.async 99
Basics of core.async Channels 101
Serving Tea at a core.async Tea Party 104
Creating a Tea Party to Be Run from the Command Line 107
Sharing Your Tea Party with Others by Creating an Uberjar 109
7 Creating Web Applications with Clojure 111
Creating a Web Server with Compojure 111
Using JSON with the Cheshire Library and Ring 115
Using Clojure in Your Browser with ClojureScript 120
Browser-Connected REPL 125
Making HTTP Calls with ClojureScript and cljs-http 127
DOM Control with ClojureScript and Enfocus 129
Event Handling with Enfocus 131
Summary of Our Clojure and ClojureScript Web Application 135
Other Useful Web Development Libraries 135
Using Hiccup for Templating 135
Using Enlive for Templating from Static HTML Files 136
Using Liberator for Content Negotiation and Other Good Things 137
Using Transit for a Small, Fast JSON Alternative 139
Using Om for Powerful Client-Side Applications 140
Using Hoplon and Luminus for Inclusive, Bundled Libraries for Web Development 140
Dealing with Databases 140
8 The Power of Macros 143
Exploring Macros 143
Creating Our Own Macros 145
Using Templating to Create Macros 148
Part II Living Clojure Training Program
9 Joining the Clojure Community 153
Clojure Documentation 153
ClojureDocs 153
Grimoire 156
Going to the Source 157
Which Libraries to Use 158
Clojars 158
CrossClj 158
ClojureWerkz and the Clojure Toolbox 159
Clojure News 161
Finding Other Clojurists 162
Chat 162
Conferences 163
Getting Help with Problems and Questions 163
Building Things with Other Clojure Enthusiasts 164
Summary 165
10 Weekly Living Clojure Training Plan 167
How Do I Use This Training Plan? 167
What If I Miss a Day or Two? 167
What If I Don't Understand the Exercise? 168
Week 1 168
Week 2 181
Week 3 187
Week 4 190
Week 5 196
Week 6 200
Week 7 203
Congratulations 207
11 Further Adventures 209
Get Ready for Transducers 209
Further Reading 213
Index 215