O'Reilly logo

Functional Programming: A PragPub Anthology by Michael Swaine

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required