POSTS
Getting Set Up with Clojure
Before you begin writing Clojure, you’ll need to equip yourself with some tools first.
Installing Java
Clojure runs on top of the Java Virtual Machine (JVM). The JVM can be obtained by installing the Java Runtime Environment (JRE) or the Java Development Kit (JDK). Strictly speaking, you can run and do development with Clojure using the JRE alone, but it’s a good idea to install the JDK as it’s needed by leiningen (see below). You can grab both the JDK and JRE from your operating system’s package manager, or from here.
Choosing an editor
Exploring the development tools, libraries, and other parts of the ecosystem that come with a language is always exciting, at least for me. Just for editing Clojure code there are already many different tools available, all of which are viable choices. At this point, Light Table is still in development, but is perfectly usable and doesn’t require much setup, so is probably a good pick if you don’t have a favourite editor already.
Setting up a build tool
A build tool automates the process of gathering all the source files in your project and feeding them to the compiler. If you’ve worked with programming languages like Java and C++ before, you might be familiar with such tools such as Ant, Maven, or Make.
In the Clojure ecosystem, the most popular build tool is leiningen. Despite being very powerful and extensible, it’s not too difficult to learn. You’ll need leiningen to create Clojure projects and perform some other tasks in future articles on this site, so follow the installation instructions on the home page to get it running.
Finding references
Here are some handy Clojure references:
- clojure-doc.org - Guides on various Clojure topics, useful for all skill levels
- ClojureDocs - A quick reference for Clojure APIs, including some third party libraries. Lots of functions come with examples contributed by the community. The quick reference is worth bookmarking as well.
Note that some of the function API descriptions can be quite hard to understand. Don’t worry about it! I recommend looking at the examples, and trying out the function for yourself to see how it works.
-
clojure