The REPL
A good way to get to know this system is to start with Clojure’s interactive programming environment, the Read Eval Print Loop, or REPL.
You know what a REPL is: a user of the REPL types some code. The REPL reads it in, turning it from a string into another data structure. That data structure is then evaluated to produce a value, which is printed. Finally, the REPL loops back to the beginning, waiting for new input.
You will find instructions for installing a REPL in Chapter 20, Clojure’s Exceptional Handling of Exceptions.
Let’s start off in the classic style by running “hello, world” in the REPL.
| | => (println "hello, world") |
| | hello, world |
| | nil |
If we’d like to add two numbers together, the syntax looks the same. Here, we ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access