What are the main benefits of Elixir compared to Clojure?

I think is always good to learn new languages because you can have different points of view on how solving problems.

IMO. Learning erlang / BEAM would make someone better in Elixir because this one would know what happens behind the scenes.

For the record, here’s a good tl;dr on BEAM vs JVM

1 Like

that means of course that, when you change an opinion, a new you is ceated…
Gladly it shares everything else, structurally, with your old yourself.


In the words of Ken Tilton:

Parentheses? What parentheses? I haven’t noticed any parentheses since my first month of Lisp programming. I like to ask people who complain about parentheses in Lisp if they are bothered by all the spaces between words in a newspaper…


Why is so complicated to talk to other developers? I am not complaining about anything. It’s just my opinion. I don’t think I should waste time discussing if fork is better than spoon. They are both tools and that’s it. Use what you need.

He didn’t really say you were complaining.

1 Like

Right, sorry. I should have emphasized the first part of the quote. The point of the quote is that, after a while of programming in Lisp, the parentheses become invisible. You get used to them, especially with a good editor.

But yes, the parens are a feature. It’s not so much that lispers like parens as much as they like the benefits of using s-expressions. Note how Clojure introduced square brackets and curly braces, but kept the s-expressions. (Unlike, say Dylan, which tossed out sexprs for a more ALGOL-like syntax.)


Thank you for clarifying. I am sorry too.

1 Like

Have you ever worked with Leiningen?
Maven repo download speed?
Clojure stack trace?
Java-Clojure interop and its type syntax?
JVM startup time?
Missing parentheses?
JVM 8 and 12 incompatibility?

And so on…

I have so much scar about clojure, but when it works, it works.

As to answer of the benefit of elixir, is I don’t have to deal with those pain.

1 Like

I’ll see your Clojure stack trace and rais you a Scala/Play stack trace :laughing:

I’m C# programmer by profession and I don’t know much about Clojure but knowing it runs on top of JVM, this video explains benefits of BEAM that Elixir runs top of and why it’s so great compared to JVM and .NET VMs.

I can use clojerl and get all of that.

I don’t like parentheses, you like parentheses. It’s fine.

It’s not a matter of taste.

Well, I think we discussed parentheses enough, let’s not make it too big of a thing now :slight_smile:

I did not know clojerl, interesting!


Can it give you access to Elixir’s macros though? They are a very important selling point of Elixir.

You get lisp macros, not sure if you can use Elixir’s without some sugar but it might be doable.

Yes please. I don’t know why people get fixing on I what I said.

I think popularity matters and it’s great that there is project like cloerl, but I think it’s very hard to get into that point where language is popular on a platform and Elixir has been able to do that. Some JVM languages have been able to do that as well. I’m not sure if there are any language for .NET except C#, Visual Basic and F# and all those are from Microsoft.
I hope cloerl gets to that point but currently who would want to use it in serious business project?

1 Like

#1 Elixir is not a Lisp, Clojure is one

The parenthesis and s-expressions are actually a big part of this question, as well as the dynamism of the language compiler and the REPL driven development it brings. Those things go hand in hand, and are integral to what makes Lisp interesting.

This is also the hardest part to explain, and is almost impossible to answer to someone asking, because the importance of syntax as a means of expression and its semantic implications is a very abstract thing.

In Lisps, the code is the unambiguous tree of evaluation, it is what actually gets transformed and computed, you’ve removed a layer between you and the machine. It’s the closest syntax to pure untyped lambda calculus you’ll find.

Clojure is a Lisp, and Elixir is not. That’s a big difference.

You have to wonder, why is it every language has someone writing a Lisp syntax for it? You don’t see that happening with other syntaxes. And I wish I could explain the appeal, but it’s not easy to convey.

Like others have said, the syntax is “simple”. What that means is that the rules for how it works are very few and very clear and unambiguous. It means that you start with very few building blocks, and from those you can accomplish everything. It means that it is well structured, and thus easy to parse and manipulate, which makes it in turn easy to extend. Since it is so unambiguous, it also means it’s a great way to serialize data of any form. And because it already forms an evaluation tree, it can be manipulated and edited at the evaluation structure level, what Lisp editors refer to as “structural editing”. It also means that everything is “unambiguously scoped and self-contained”, and that makes it trivial to build a REPL around, with clearly delineated forms that can be “read” as a unit and compiled as a unit.

These properties in my opinion makes it a superior syntax in all aspects over Elixir’s, except for:

  1. It isn’t as familiar to people, and appears visually noisy
  2. As a result of #1, it is harder for newcomers to learn and appreciate
  3. As a result of #2, which means it doesn’t attract as many people to it, it tends to also limit the growth of a language and thus the number of people contributing libraries, frameworks and patches to the language
  4. It gives so much power to the programmer, that they can be tempted to go wild with it even beyond the point of what mortals should attempt

A superior syntax doesn’t mean that it will result in you writing superior programs with it. That is very much dependent on your own ability to leverage it to your needs, and your own mental model.

What it does mean is that for people who do care, and are looking for these properties that s-expressions bring, Elixir not being a Lisp and Clojure being one is a huge factor on deciding to use Clojure over Elixir. Similarly, for people that don’t care, it is a huge factor in choosing Elixir over Clojure.

#2 Elixir runs on the Beam VM, Clojure runs on the JVM

This is the second biggest differentiatior. The style of programs you can write and how you write them will be dramatically different because of the difference in those runtimes.

The BEAM is designed from the ground up to run distributed systems, that means that you cannot have two piece of code run concurrently or in parallel in ways where they share data. It also means that it doesn’t rely on the OS threads for concurrency and parallelization, implementing its own scheduler for concurrent code execution.

It also means that it’s exception handling is modeled for distributed systems, providing all the tools you need to easily add fault tolerance and resiliency to such a system, as well as giving you ways to communicate across nodes of such a system and synchronize nodes and all that.

Elixir takes advantage of all this in turn of running on the Beam VM.

The downsides of this comes at the expense of performance for non-distributed applications, single thread performance of single machine multi-threaded code. There’s always going to be overhead in exchanging data instead of sharing it straight form memory.

Another downside, but that could change in the future, is just the investment put behind each VMs, the JVM has been funded a lot more, it has thus had a lot more optimization go into it and many companies offer long term support and all that for every version of it imaginable.

Lastly, a possible downside is similarly in the popularity of the two VMs, and thus the amount of existing tooling and libraries/framework around both, it’ll tend to be till now that the JVM has more of it.

#3 Elixir is weird, Clojure is weirder

Elixir is weird, it has different ways for doing things than your typical OO imperative language. You have pattern marching, modules, actors, enumerations, streams, and all other such things, there’s a lot to learn. But in Clojure, there’s even more weird stuff to learn, metadata, transducers, multimethods, drastically different ways of doing concurrency like executor services, futures, locks, stm, agents, csp, reducers, and just in general you’ll be faced with weirder things to learn.

#4 Elixir is much closer to Erlang than Clojure is to Java

The general semantics of Elixir are much closer to those of Erlang, the host default language. That just means you’re not gonna hit your head as often from issues that comes from just how different Java is to Clojure and really how annoying in a lot of ways Java is overall.

You won’t see a lot of Clojure programmers say that Java is all that great, it does an okay job but at the cost of a lot of annoyances to a Clojure programmer.

On the other hand, Erlang itself is quite a good language, if using itself a bit of an unfamiliar syntax which can be hard to approach. And you’ll find a lot of Elixers who have quite the respect and appreciation for Erlang, not so in the case of Clojurians towards Java.

#5 Elixir has big frameworks that have made all the hard decisions for you and don’t demand you to understand a lot to get going and build apps, while Clojure expects you to know everything

Phoenix is a great example of this, how many people learn Elixir through learning Phoenix?

In Clojure, a common question is… What project should I even try to use as my first one to learn Clojure? Because there’s no obvious framework to guide you at anything, even the kind of projects you should try to build.

Clojure simply expects you to know how to build software already, and that you already have your own personal opinion of how you prefer to go about doing things, so instead of giving you frameworks with opinions and a lot of the basic done for you, it just gives you tools to let you build your own personal framework more quickly.

#6 Elixir is only Elixir, Clojure is now a whole generation of dialects

Elixir (as far as I know), is only Elixir. Clojure is now a source of inspiration for many other languages, most of which try to achieve portability back with Clojure.

This is where you have ClojureScript, a Clojure-like that is hosted on JavaScript environments, and for which code can be written that can be consumed by both Clojure and ClojureScript.

You also have ClojureCLR and MAGIC, which are both dialects of Clojure that target the .NET CLR and the Unity runtime respectedly. Code can similarly be written in a portable way across them back to Clojure.

You’ve got Babashka, which is a scripting language that is a dialect of Clojure meant to compete with Python, Perl, Bash and the likes for common scripting tasks. It too can share common code portable between itself and Clojure.

Interestingly, you also have Clojerl, which is a dialect of Clojure that runs on the BEAM VM just like Elixir. I believe there is some level of code portability back with Clojure as well. Though this one is more in alpha state I’ve heard.

And you have many more in the works, or that are more niche, like ClojureDart, a new Clojure dialect targeting Dart. You have Ferret for hard real time embedded systems.

I’m not too sure why there are so many Clojure dialects compared to Elixir, I think one reason is that Lisp heritage, it makes implementing Clojure a lot easier I believe because of the underlying simplicity. But it could also be because Clojure has more of a self-identity in its own semantics, that Elixir would find harder to re-implement itself without all that the Beam provides. Another reason might just be Elixir is newer, or that less people need an alternative to the Beam compared to the JVM :joy:

#7 Elixir startup is slow, Clojure is slower but…

Elixir startup isn’t as snappy as some might want for things like AWS Lambda, or script and CLI use cases. That said, Clojure start time are even slower. Yet since GraalVM can compile Clojure code to native binaries (something I do not know to be possible with Elixir), with a bit of extra effort Clojure can be made to start really really fast and with no required runtime to be installed to run.

#8 I am obviously biased towards Clojure

I prefer Clojure, and I use it professionally, while I only do Elixir on some of my hobby projects as a fun learning and thing to do on the weekends. With most of my hobby projects still being Clojure or a dialect of it. So keep that in mind when reading my comparison and maybe my framing of certain differences. I tried to remain factual and unbiased, but there is no such thing as truly unbiased.

Hope that helps!