A Namespace of Your Own

Now that you’ve seen how to create new namespaces in the REPL and how to get namespaces loaded with require, we’re ready to take the final step: defining a namespace of our own in a real .clj file in a directory project.

Let’s start by creating a new Clojure application. Recall from Chapter 1, Hello, Clojure that we can use Leiningen to create a new Clojure project like this:

 $ lein new app blottsbooks

Run those commands, and you will end up with a fully functional, if skeletal, Clojure project. For our purposes, the key bit of the project is a single source file that you’ll find at src/blottsbooks/core.clj.

Inside of that file you’ll find the following:

 (ns blottsbooks.core ...

Get Getting Clojure 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.