Lesson 8. Interactive development
In this lesson, you are going to install Clojure on your machine and you will learn how to evaluate Clojure expressions for real from the command line and inside the REPL.
After completing this lesson, you will:
- Have Clojure installed on your machine
- Know how to evaluate Clojure expressions from the command line through Clojure CLI
- Have the Klipse REPL installed in your machine
- Know how to evaluate Clojure expressions inside the Klipse REPL
8.1 What is a REPL?
A REPL (standing for Read-Eval-Print Loop) is an interactive programming environment that allows developers to evaluate pieces of code and get immediate results.
In a REPL, the developer enters one or more expressions rather than an entire file and the REPL evaluates them and displays the results of the evaluation of the expressions.
Nowadays, REPLs are available in many programming languages:
- javascript has the browser console
- node.js has a command line console
- ruby has irb
- python has a REPL
- Java has Jshell (since Java 9)
The REPL provided by Clojure is powerful because Clojure was designed with the REPL in mind.
8.2 The value of a REPL
The REPL gives the developer an interactive development experience. When developing a program, the developer builds small parts of the program and validates the behaviour of each part before combining them in a whole program. This development workflow leads to shorter development cycles than the classic edit-compile-run-debug cycle.