How to Read This Book

All readers should begin by reading the first two chapters in order. Pay particular attention to Simplicity and Power in Action, which provides an overview of Clojure’s advantages.

Experiment continuously. Clojure provides an interactive environment where you can get immediate feedback; see Using the REPL for more information.

After you read the first two chapters, skip around as you like. But read Chapter 3, Unifying Data with Sequences before you read Chapter 6, State and Concurrency. These chapters lead you from Clojure’s immutable data structures to a powerful model for writing correct concurrency programs.

As you make the move to longer code examples in later chapters, make sure you use an editor that provides Clojure indentation for you. If you can, try to use an editor that supports parentheses balancing, such as Emacs’ paredit mode or the Cursive plugin for IntelliJ. This feature will be a huge help as you’re learning to program in Clojure.

For Functional Programmers

  • Clojure’s approach to FP strikes a balance between academic purity and the realities of execution on the current generation of JVMs. Read Chapter 4, Functional Programming carefully to understand how Clojure idioms differ from languages such as Haskell.

  • The concurrency model of Clojure (Chapter 6, State and Concurrency) provides several explicit ways to deal with side effects and state and will make FP appealing to a broader audience.

For Java/C# Programmers

  • Read Chapter 2, Exploring Clojure carefully. Clojure has very little syntax (compared to Java or C#), and we cover the ground rules fairly quickly.

  • Pay close attention to macros in Chapter 8, Macros. These are the most alien part of Clojure when viewed from a Java or C# perspective.

For Lisp Programmers

  • Some of Chapter 2, Exploring Clojure will be review, but read it anyway. Clojure preserves the key features of Lisp, but it breaks with Lisp tradition in several places, and they are covered here.

  • Pay close attention to the lazy sequences in Chapter 4, Functional Programming.

  • If you like Emacs, get a mode for Clojure that makes you happy before working through the code examples in later chapters. There are many options, but consider inf-clojure for a minimalist setup and CIDER for a full-feature environment.

For Perl/Python/Ruby Programmers

  • Read Chapter 6, State and Concurrency carefully. Intraprocess concurrency is very important in Clojure.

  • Embrace macros (Chapter 8, Macros). But do not expect to easily translate metaprogramming idioms from your language into macros. Remember always that macros execute at read time, not runtime.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.200.106