Clojure's interactive shell (REPL)
Using the startup script, you can now run Clojure's REPL interactive shell from Clojure by simply running a simple script. Unlike Scala's scala
REPL interactive shell, Clojure's REPL does not have its own custom commands. As we have already seen, to gracefully exit, you have to call the java.lang.System
class's exit()
method by typing (System/exit 0)
:
Clojure does not come with a standalone compiler command. Instead, it generates and executes JVM bytecode in memory while executing Clojure code. To generate class files that will be saved in a directory on the filesystem, which can be used by other JVM languages, you'll have to call ordinary Clojure functions. We will demonstrate this functionality in the next chapter.