The functions illustrated in this section are at the core of the read, evaluation and print loop (the REPL for short). When you open the Clojure REPL, you’re welcomed by a prompt waiting for a form to evaluate. The prompt is effectively a blocking call to the read function using the standard input as argument. After hitting the return key, eval analyzes the forms and emits the related bytecode that immediately executes. The result is printed on screen and the loop continues blocking on the next read
call. Clojure uses the same read
and eval
functions extensively also outside the REPL.
The following is a summary of the functions illustrated in this chapter and their role during the evaluation cycle: