Get Started with Clojure#
Welcome to an interactive guide to get you started with Clojure. You will learn Clojure in the way it is intended to be used: from within your editor, jacked in to the running application.
You will need Java, VS Code, and Calva (a Clojure extension to VS Code). Instructions for where to find installers are provided further down on this page. You will also install the Clojure CLI tools, because this is about Getting Started with Clojure.
I am new to VS Code
You may want to have a look at this Getting Started with VS Code video. Also, have this overview of the VS Code interface handy.
If you have these things installed, and just want to get going, jump to Run the Getting Started REPL below.
What you'll learn#
- The basics of the Clojure language (at least the start of the basics)
- The basics of Calva (It's a bit as a side effect. You need it to learn Clojure this way, and by learning Clojure this way, Calva knowledge trickles in.)
- What is meant by, and some ways to perform, Interactive Programming (aka REPL Driven Development)
- Where to find Clojurians, i.e. folks who use Clojure and care about it (you will thus find help, the friendliest help you have ever seen a community provide)
I am not convinced I should spend time on learning Clojure
Fair enough. We can recommend watching any or all of these videos to get excited about Clojure and the rather unique mood of development it offers:
- Solving Problems the Clojure Way - with Rafal Dittwald (using JavaScript, so no new syntax to grasp to get the message)
- Developer Ergonomics with VS Code, Clojure, and ClojureScript - with Peter Strömberg
- Clojure in VS Code Workflow using FizzBuzz - with Peter Strömberg
What you won't learn#
- About various old and new build and dependency tools
- How to create projects
Why won't I learn about this?
All in due time. 😄 Creating a Clojure project can mean a lot of different things, and demand different tooling, depending on a what kind of project it is. That said, the Getting Started Guide itself is a small Clojure project, so you can keep building on it as your first Clojure project.
Let's go!#
Ready? Awesome. Let's start by installing the needed stuff.
Install#
- Java: There are downloads and instructions for your system here: Oracle: Java Downloads. Or, to give yourself a great Java SDK manager, consider using SDK-MAN!. (Even works on Windows under Windows Subsystem for Linux, aka WSL.)
- Clojure CLI: Follow the instructions at: Clojure CLI tools.
- VS Code: Download installer for your system here: VS Code Downloads.
- Calva: Start VS Code and search for Calva in the Extensions pane. You can open the Extensions pane by running the command Extensions: Install Extensions... from the VS Code command palette.
Using Windows?
The official Clojure CLI tools can be hard to get working on Windows. Consider using deps.clj, a cross platform drop-in replacement for the clojure
tool, written in Clojure. Here's a Windows installer that will install the deps.clj versions of clojure
and clj
on your system. (Instructions at the link.)
If installing clojure
proves to be a problem on your machine, you can skip it for now. The guide will work without it.
I don't want to install anything
OK. There is actually a zero-install option, with VS Code running in the browser (using https://gitpod.io). Click this button to start the guide.
Run the Getting Started REPL#
You will be running the guide from within VS Code, starting it from the VS Code command palette.
The guide will:
- Ask you to select a folder to create the Getting Started project in
- Create and open that project
- Open a few Clojure files, introducing you to some basics of how to use Calva and then to learning Clojure.
The instructions will be in the form of Clojure comments, and you will be running the Clojure code snippets in the files, as well as be encouraged to edit and add code.
The command to run is: Calva: Fire up the Getting Started REPL.
That's it. Do it now. This page has some more information to make the start of your Clojure adventure fun and smooth. It ain't going anywhere, though. 😀 Come back to it.
Stuck? Something not working? Or just unclear?
Please don't hesitate to reach out for help, should you get stuck. See below for where to find Clojurians. As for the Calva team, we are almost always (true story) to be found at the Clojurians Slack, especially in the #calva
Channel.
Happy Interactive Programming! ❤️
And where do I find those Clojurians?#
We Clojurians inhabit a lot of community platforms. I'll list some of the more popular ones here in some order of popularity.
- The Clojurians Slack - by far the largest and most active Clojure community, the
#beginners
channel is spectacularly fantastic - ClojureVerse - a web forum. Lots of Clojurians, lots of Clojure knowledge collected, easy to search, easy to join
- /r/Clojure - Reddit when Reddit is at its best, lots of Clojurians here
- Clojurians on Zulip - An other web forum using the Zulip platform
- On Discord there are two active servers: Clojurians and Discord
You can also ask questions, and find answers, about Clojure at ask.clojure.org
Learn and Practice Clojure using Rich 4Clojure#
If you like the style of interactive learning that this guide provides, you should definitely check Rich 4Clojure out. It also can be used in the zero-installed way.
You can regard it as a companion to this guide. It is aimed at practicing Clojure, starting at the elementary levels, bringing you to advanced stuff.
Can I use Rich 4Clojure instead of this guide?
We suggest you start by opening up this guide and do the Calva part of the excerises. Then use the welcome_to_clojure.clj
guide in combination with Rich 4Clojure..
Run the Clojure Exercism Track in your browser#
In a similar manner to the Get Started with Clojure project, you can run the Clojure Exercism Track in your browser without installing anything and with full Interactive Programming enabled using this Template project.
ClojureDocs#
Clojurians draw tremendous value from ClojureDocs. At ClojureDocs the concise documentation for Clojure core functions, etcetera, are amended with examples and advice from fellow Clojurians. Crowdsourcing at its very best! It is a big part of the reason why you won't find an abundance of Clojure information at StackOverflow.
Other learning resources#
- CalvaTV - Calva's YouTube channel often focuses on beginning with Clojure and ClojureScript. Subscribe, please!
- Clojure Beginner Resources - a much more comprehensive list than this one
- clojure.org Getting Started - the source of truth, includes installing and stuff
- The Exercism Clojure track - Learn solving carefully crafted Clojure exercises, get mentor feedback if you like.
- Clojure for the Brave and True - helping you from beginner to pretty advanced stuff, very popular among Clojurians
- on the code again - often features Clojure concepts, with snappy, well communicated, and entertaining videos
- Clojure Koans with VS Code/Calva instructions
Help us help beginners#
Give us feedback. Spread the word. Please consider:
- Join the
#improve-getting-started
channel at the Clojurian Slack - Linking to this page from your blog
- Tweeting about this guide
- Contributing to the Calva project
- Wearing Calva and RFC T-shirts
- Starring these repositories:
- Get Started with Clojure - (the repository powering this guide)
- Rich 4Clojure
- Clojure Exercism Track Template
- Calva
- Dram - Where this guide (the Getting Started REPL) is authored
- What do beginners struggle with? - a ClojureVerse thread, where you can tell us about what you have found hard in picking up Clojure. It's what spawned the creation of this guide.
Please also consider other ways to contribute.
Thanks! 🙏