Living Clojure

Book description

If you’re an experienced programmer who has not worked with Clojure before, this guide is the perfect thorough but gentle introduction for you. Author Carin Meier not only provides a practical overview of this JVM language and its functional programming concepts, but also includes a complete hands-on training course to help you learn Clojure in a structured way.

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

Publisher resources

View/Submit Errata

Table of contents

  1. Preface
    1. Who This Book Is For
    2. How to Use This Book
      1. Do Try the Examples
      2. Don’t Feel Overwhelmed
      3. Don’t Worry About the Parens
      4. One More Thing—Have Fun!
    3. What You Need to Use This Book
      1. Install Java
      2. Getting Your Clojure REPL Ready
    4. Conventions Used in This Book
    5. Using Code Examples
    6. Safari® Books Online
    7. How to Contact Us
    8. Acknowledgments
  2. I. A Guided Tour of Clojure
  3. 1. The Structure of Clojure
    1. Baby Steps with Simple Values
    2. Put Your Clojure Data in Collections
      1. Using a List Collection
      2. What Can We Do with Lists?
      3. Using Vectors for Collecting Data by Index
      4. What Collections Have in Common
      5. Maps for Storing Key-Value Pairs of Data
    3. Using Sets for Unique Collections of Data
      1. Summary of Simple Value and Collections
    4. Lists Are the Heart of Clojure
    5. Symbols and the Art of Binding
    6. Creating Our Own Functions
      1. Keep Your Symbols Organized in Namespaces
  4. 2. Flow and Functional Transformations
    1. Controlling the Flow with Logic
      1. Logic Tests You Can Use on Collections
      2. Harnessing the Power of Flow Control
    2. Functions Creating Functions and Other Neat Expressions
    3. Destructuring
    4. The Power of Laziness
    5. Recursion
    6. The Functional Shape of Data Transformations
      1. Map the Ultimate
      2. Reduce the Ultimate
      3. Other Useful Data Shaping Expressions
  5. 3. State and Concurrency
    1. Handling Real-World State and Concurrency
      1. Using Atoms for Independent Items
      2. Using Refs for Coordinated Changes
      3. Using Agents to Manage Changes on Their Own
  6. 4. Java Interop and Polymorphism
    1. Handling Interop with Java
    2. Practical Polymorphism
  7. 5. How to Use Clojure Projects and Libraries
    1. Getting Set Up with a Clojure Editor
    2. Creating Our Project with Leiningen
    3. Dependency Management with Leiningen
    4. Using Libraries in Your Own Project
  8. 6. Communication with core.async
    1. Basics of core.async Channels
    2. Serving Tea at a core.async Tea Party
    3. Creating a Tea Party to Be Run from the Command Line
      1. Sharing Your Tea Party with Others by Creating an Uberjar
  9. 7. Creating Web Applications with Clojure
    1. Creating a Web Server with Compojure
    2. Using JSON with the Cheshire Library and Ring
    3. Using Clojure in Your Browser with ClojureScript
    4. Browser-Connected REPL
    5. Making HTTP Calls with ClojureScript and cljs-http
    6. DOM Control with ClojureScript and Enfocus
    7. Event Handling with Enfocus
    8. Summary of Our Clojure and ClojureScript Web Application
    9. Other Useful Web Development Libraries
      1. Using Hiccup for Templating
      2. Using Enlive for Templating from Static HTML Files
      3. Using Liberator for Content Negotiation and Other Good Things
      4. Using Transit for a Small, Fast JSON Alternative
      5. Using Om for Powerful Client-Side Applications
      6. Using Hoplon and Luminus for Inclusive, Bundled Libraries for Web Development
      7. Dealing with Databases
  10. 8. The Power of Macros
    1. Exploring Macros
    2. Creating Our Own Macros
    3. Using Templating to Create Macros
  11. II. Living Clojure Training Program
  12. 9. Joining the Clojure Community
    1. Clojure Documentation
      1. ClojureDocs
      2. Grimoire
      3. Going to the Source
    2. Which Libraries to Use
      1. Clojars
      2. CrossClj
      3. ClojureWerkz and the Clojure Toolbox
    3. Clojure News
    4. Finding Other Clojurists
      1. Chat
      2. Conferences
    5. Getting Help with Problems and Questions
    6. Building Things with Other Clojure Enthusiasts
    7. Summary
  13. 10. Weekly Living Clojure Training Plan
    1. How Do I Use This Training Plan?
    2. What If I Miss a Day or Two?
    3. What If I Don’t Understand the Exercise?
    4. Week 1
    5. Week 2
    6. Week 3
    7. Week 4
    8. Week 5
    9. Week 6
    10. Week 7
    11. Congratulations
  14. 11. Further Adventures
    1. Get Ready for Transducers
    2. Further Reading
  15. Index

Product information

  • Title: Living Clojure
  • Author(s):
  • Release date: April 2015
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781491909041