Browse Learn Clojure Foundations as a Java Developer

Setting Up the REPL

Build the core Clojure inner loop: start the right project REPL, connect your editor, evaluate forms safely, reload namespaces, inspect values, and keep the running JVM aligned with source.

If you only change one habit from Java to Clojure, make it this: keep a REPL running and use it constantly. The REPL is not a toy console; it is the main way Clojure developers explore code, validate assumptions, and iterate without long compile-run cycles.

What You Should Be Able To Do Comfortably

  • Start a REPL for a specific project (with the right classpath).
  • Connect your editor so you can evaluate forms quickly.
  • Load/reload a namespace without restarting the whole JVM.
  • Inspect values (including nested maps/vectors) without printing noise.
REPL task What it proves
Evaluate a literal or small expression The editor-to-REPL connection works
Evaluate a function definition Source changes can be loaded into the running JVM
Call the function with sample data You can inspect behavior before writing a full integration path
Run a test namespace The project classpath and test tooling are aligned
Reload after changing dependencies You understand when a REPL restart is required

Java mental model: it is closer to “a live debugger session with a programmable console” than to a script runner.

This section sets up the workflow that makes every later chapter faster and more trustworthy.

In this section

  • Understand the Clojure REPL
    Understand the Clojure REPL as a running JVM process where Java engineers can evaluate forms, inspect values, reload namespaces, and shorten the edit-run-debug loop.
  • Start the Right Clojure REPL
    Start standalone, project-connected, Leiningen, Clojure CLI, and editor-connected REPL sessions, and choose the mode that matches the code and classpath you need.
  • Evaluate Forms in the REPL
    Use the Clojure REPL to evaluate complete forms, inspect return values, require helper namespaces, work with recent results, and avoid confusing scratch state with saved source.
  • Manage Namespaces and Reloads in the REPL
    Work with namespaces, require and reload source files, inspect errors, interrupt bad evaluations, and understand when a running REPL needs a restart instead of another reload.
  • Use the REPL in Daily Clojure Workflow
    Turn the REPL into a daily engineering workflow: connect the editor, evaluate source-backed forms, capture decisions in tests, and avoid hidden state that teammates cannot reproduce.
Revised on Saturday, May 23, 2026