DEV Community

Sean Walker
Sean Walker

Posted on

Go from zero to clojure in 60 seconds

I’ve shared this before, but I figured I should write something about it again since things have shifted so dramatically in the clojureverse. It used be that leiningen or boot were the go-to tools for clojure development, but they were confusing and often times had a lot more features than what was absolutely necessary. Any clojure developer will tell you that simplicity should come above ease at all costs!! No, I’m kidding, Im not going to extol the virtues of simplification or get into a pedantic argument over what’s easy or simple. Look, let’s just dive right in.

It's easy

The major difference is ease, head to clojure’s getting started page and install clojure for your platform. My platform is and hopefully will always be MacOS, so here’s the big enchilada:

brew install clojure
Enter fullscreen mode Exit fullscreen mode

That’s it! You’re done, you have clojure installed. Congratulations! 🎉🍾🎈🎊

Start it up with clj and you can start typing clojure code into your terminal with no fuss and cuss... ing. Good job! Of course setting it up for repl<->editor integration is a little harder, but that needs to be a screencast anyway. Sit back, relax and pat yourself on the back for a job well done 👍


Now that you have clojure installed let's do one useful thing with it, sum numbers! Super useful! Make a new directory and add two files and a folder like this:

mkdir -p summer summer/src
cd summer
echo '{:paths ["src"] :deps {org.clojure/clojure {:mvn/version "1.9.0"}}}' >> deps.edn
echo '(ns core) (defn -main [] (println (+ 1 2 3)))' >> src/core.clj
Enter fullscreen mode Exit fullscreen mode

Go ahead and run it like this

clj -m core
Enter fullscreen mode Exit fullscreen mode

It should output 6! 🎉

That's all there is to getting started with clojure now. 2019 might just be the year that clojure takes over the dev world!

Originally posted on

Top comments (3)

aminmansuri profile image
hidden_dude • Edited

For any language to take over the world it must have a killer app.

For example, Java became popular because Servlets / JSP were far superior over ISAPI filters (and it was marketed as the language for the Web).

C became big because of Unix and later Windows (both Win16 and Win32) which dominated young programmer's minds in the early 90s. C++ later became popular because of Win32 and MFC.

Ruby became popular because of Rails and the promise that web application development could be heavily simplified.

SQL became popular because of the rise of relational databases.

Objective-C became popular because of the iPhone (Swift because they wanted an alternative to Objective-C).

Javascript gained its dominating position after Google demonstrated GMail: a very versatile client based web app that was actually great to use. Thus the "AJAX" revolution in Javascript and the subsequent long list of libraries to support better and richer client side JS.

So if Clojure is going to take over the world, what is its "killer app"?
What great proof of concept is going to make us bother to move over?

Theoretical benefits rarely matter. Otherwise we'd all be programming in Scheme, Haskell, or Smalltalk.

jreighley profile image

Clojure is adopted by the big corporations because it's immutability makes it trivial to scale into multi-threading, multi-processors and big data across cloud instances. It is used way more than people think. You talk to some Clojurists from big companies, and they have 100 or so Clojure developers out of a java ecosphere with thousands.. They don't talk about it much, but that doesn't make it at all insignificant.

Clojure is adopted by start-ups and such because it's repl driven development makes getting from idea to prototype very fast and easy. It's dynamic typing allows you to go straight into solving business problems without building a ton of data structure objects in advance.

Clojure also tends to come out on top on nearly all bug studies. Breaking changes are rare.

Those are the killer ideas propelling Clojure. It probably will never take over the world, but those who use it love it, and do pretty well for themselves by and large. It has a solid enough footprint that it isn't going away anytime soon.

aminmansuri profile image

Well JS has its place and its unlikely to yield for the time being.

But I wouldn't go so far to say that there will never be a big change. I've seen radical changes (as illustrated above).

Python is popular because of numpy and because its being taught as a first language. People are doing with Python what they used to be doing with Matlab (and previously Fortran). But we're at a unique point in history where a whole new generation is being trained in Python and JS is one of the most important languages out there. So for the first time in history we have a dynamically typed language as a main introductory language. When these people become decision makers its going to affect what technologies are used.

But Python and JS live in different worlds.