They are however, both a Lisp, one of the most fascinating languages ever discovered (see do aliens have lisp?). It’s not a perfect foundation, but it’s an extremely powerful and flexible one with a long and colourful history. Wikipedia will do a better job at listing that history than I can ever do, but here’s some key facts.
- Originally designed for AI research
- Has a huge amount of dialects which share the core tenants, including ClojureScript, Clojure, Racket, Scheme, Lisp Flavoured Erlang and many more
- (it’s (lists (all the way (down))))
This extremely exhaustive chart that shows the history of programming languages shows just how early Lisp turned up. It’s amazing to see what influenced what, click the image to enlarge it.
So it has been around for a very long time and has appeared in many flavours. We’re going to skip all of the other fascinating Lisps in the middle and jump all the way to Clojure, one of the newest and most popular in recent years.
One cool thing about Clojure is that the language is defined by the language. By that I mean, there’s a core interpreter (called a reader) as well as some core functions written outside of Clojure, but the rest is defined in core.clj, in Clojure. If there’s ever anything you don’t understand about the language, you can actually go and read the source code for that feature, like the while macro.
- core.async – Like Go‘s channels
- core.typed – Gradual typing
- core.match – Pattern matching
- core.logic – Logic programming (check out Prolog, it’s really cool!)
- core.matrix – Matrix and array programming
- schema – Declarative data validation
- factjor – Stack programming
- test.generative – Generative testing!
My friend Ludwik at work described it well.
You learn this one thing and it can take you to ALL the places.
No kidding, you can do anything with it, it’s the most flexible language I’ve ever researched. To me, it’s a host unifier, you have every paradigm and every platform within the same beautiful language. This versatility means it’s being used all over the world in various industries to solve all sorts of interesting and hard problems, as the 2015 survey shows. Ludwik actually uses it day to day at Qubit with his team.
There’s excellent integration into many popular text editors and IDEs, including: Sublime, Atom, Vim, Emacs and LightTable (actually written in ClojureScript). Cursive is an IDE developed specifically for Clojure which seems pretty cool too, it’s based off of IntelliJ. I use Vim personally and have written about it in the past. All of the tooling hooks into a running REPL which allows you to look up source code, documentation and execute things directly from your editor.
Editing Clojure is fun too, because you’re editing the actual AST so you can perform structural editing with things like Paredit or Parinfer. Forget manually copying and pasting lines around, adjusting quotes and curly braces, you can edit the AST and always keep it correct with powerful tools.
All of this magic is driven by a very small amount of tooling, no more learning the “npm + grunt / gulp / broccoli + browserify / webpack + react + redux + immutablejs + ….” silliness. All you need is Leiningen. A simple “lein new project-name-here” will get you up and running.
Let’s assume you’ve got leiningen installed and you want to create a “Hello, World!” application with Reagent (a minimalistic React wrapper for ClojureScript, there’s a few wrappers out there though, go explore!) and live reloading through figwheel.
lein new reagent hello-reagent
# Now open http://localhost:3449
That’s all there is to it though, getting set up is extremely quick and easy. You then have a live environment to edit in any way you want, you are free to explore the language by moving and editing expression that will be sent to the browser when you write the file. The reloading keeps the state, so you can edit the page’s source while interacting with it.
So go and learn, read books, build toy projects. Explore everything this cool language and ecosystem has to offer (just look how cool devcards are!). Even if you don’t end up using it in production I can promise that it’ll teach you things that will make you a better programmer. Even if you only learn about lisp and don’t use it, it’ll change how you solve problems.
I hope this helped and that you have fun.