Getting Started

Before you start writing code, it’s good to initialize a project directory on your file system. While there are a variety of build tools and editors for Clojure, all of them expect the root of the project directory to contain a definition of the project, to have a directory containing all of the source code, a directory containing all of the test code, and so on.

We won’t need all of those—for our purposes we just need a src directory that will hold a single file of source that matches its namespace:

 $ mkdir -p src/hangman

With that sorted out, create the default source file (src/hangman/core.clj) in your Clojure editor of choice. Add the namespace declaration:

 (ns hangman.core)

You should also ensure that you have a REPL running ...

Get Programming Clojure, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.