Chapter 10. REPL-Oriented Programming
The quality of your tools is incredibly important, and can make or break the experience with a language, not to mention your degree of success more broadly. Clojure’s REPL, which we picked apart in Chapter 1, is its most foundational tool—and, as we’ll see, perhaps its most powerful as well.
As we’ve stressed from the beginning, Clojure is always compiled and has no interpreter. Further, as we learned in Chapter 5, Clojure’s compiler is fully available at runtime, making the entirety of the language available at runtime—and therefore available in the Clojure REPL. This means that:
Code you load and run in the REPL (say, in your development environment) will work and perform exactly the same as code loaded from files on disk (as they might be in a production environment).
You can use a REPL to define and redefine any Clojure construct at any time.
The ramifications of these characteristics make the REPL an absolutely indispensable part of every Clojure programmer’s toolchain in ways that are generally not true for REPLs and interpreters offered by other languages. Here, we’ll explore some of the workflows enabled by the REPL that might just change how you approach developing software.
Interactive Development
Interactive development is a loaded term that has been taken to mean all manner of things, as most modern languages offer some degree of interactivity. Even Java developers can interactively evaluate expressions, for example, when an application ...
Get Clojure Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.