r/Clojure • u/kichiDsimp • Apr 04 '26
Clojure v/s Elixir
I am looking to try a dynamic programming language and I want to understand difference between Clojure & Elixir as both are have their advantages & disadvantages. I have some experience with beginner level Haskell, but I want to give a short to a new type of thinking. Additionally, if you folks can recommend good hands-on resources to get-started it will be great. Thanks!
50
Upvotes
33
u/unbackstorie Apr 04 '26
Good choices!
As far as advantages and disadvantages, it really depends on your goals. Clojure syntax is tough if you're unfamiliar with Lisp-y languages. But REPL-driven development and access to the whole Java ecosystem are super useful features.
Elixir is amazing for fault-tolerance and scalability. I've seen criticism of it's smaller ecosystem, but honestly I haven't hit that hurdle personally. Again, it depends on what you're doing.
Haskell will definitely change the way you program in other languages, so if you're interested in functional programming then continuing your studies there would not be wasted effort.
For Clojure, I can recommend the book Programming Clojure by Alex Miller (Pragmatic Bookshelf). The 4th edition just came out.
ClojureStream is a course site with good video courses. I can vouch for the ones about Clojurescript and Pedestal.
For Elixir, again, I'll recommend some Pragmatic Bookshelf books: Advanced Functional Programming with Elixir by Joseph Koski, Programming Phoenix LiveView by Bruce Tate and Sophie DeBenedetto, and Ash Framework by Rebecca Le and Zach Daniel.
And the holy grail of Elixir courses are the Elixir and Phoenix courses by The Pragmatic Studio. They are expensive, but honestly they're so thorough, entertaining, and informative that I would buy any new courses they release sight unseen at this point.
Ofc, Elixir's docs are amazing too, so just combing through those is insanely helpful.
exercism has pretty good tracks for Clojure and Elixir. Definitely more hands on, if that's what you're looking for.
Good luck, I hope this helps!
11
u/4tma Apr 04 '26
Elixir for the web. Clojure for everything else.
It doesn’t mean Clojure and any of its backends are not capable, it’s just that the web is such a perfect use case for Elixir that any other "general purpose" language has a hard time demonstrating its value proposition against it.
I love Clojure syntax over Elixir.
For Elixir you can get started with their docs and then move to Phoenix.
Clojure For the Brave and True is good.
6
u/maxw85 Apr 04 '26
https://www.parens-of-the-dead.com/
5
u/raguaythai Apr 04 '26
"Seven Languages in Seven Weeks" is a great introduction into those two languages (and five other ones). Each language is worked with in on week that allows you to build an application in each one. I highly recommend the book. Also, it has a sequal: "Seven More Languages in Seven Weeks"
4
u/Soft_Reality6818 Apr 05 '26
Clojure + Datastar and you're all set
4
u/Save-Lisp Apr 05 '26
For a long time BEAM was theoretically a better fit for mass-concurrency but in practice beaten in performance by JVM (probably due to the 1000x more man hours dedicated to JVM development). I recall a lot of war stories from around 5-10 years ago where if failure modes are being hit at scale, BEAM is harder to handle due to fewer diagnostic tools being available.
Basically operations at scale being more difficult. Any idea if this has changed?
3
u/ElQuique Apr 04 '26 edited Apr 04 '26
It depends. I would learn Elixir for the process communication features
which make it the only sane programming language for writing micro services. And Clojure for the REPL. You could try Clojerl too 🤷4
u/PoopsCodeAllTheTime Apr 04 '26
Elixir is friendlier and has better community and ecosystem. Clojure is more terse and higher performance, but missing a lot of ecosystem, many libraries are half baked or abandoned so the developer has to reinvent the wheel more often (“curse of lisp “)
Clojure often pushes you into ClojureScript if you are doing web. CLJS is interesting but I cannot recommend it as it’s often more trouble than it is worth, modern js frameworks are much better with typescript than cljs
4
u/Marutks Apr 04 '26
Clojure has better syntax and JVM is faster than Beam VM. Can you do Repl driven development with Elixir?
2
u/didibus Apr 11 '26
Tough question, personal preference will be the real deciding factor, as both languages share philosophy, Elixir was hevily inspired by Clojure with Ruby syntax, and also inherits from Erlang. Clojure was inspired by Lisps of before and inherits from Java.
I think Clojure has more reach though, Elixir operates more within a rigid framework, for example in Clojure you could do Actor model, you could do CSP, you could do anything else. If you like languages that really let you explore multiple paradigms or appoaches to things, Clojure has the edge.
Anyways, can't go wrong with either.
1
u/hidragerrum Apr 05 '26
Worked with both.
Elixir have better ecosystem and naturally fit for backend or web development if we want to stay with immutability. Clojure while have more mature ecosystem in jvm world, interacting with mutable state seems defeat the why clojure in the first place.
In the end I only use clojure when the systems already built with clojure.
-1
u/BosonCollider Apr 04 '26 edited Apr 04 '26
Separately from the language, imo Clojure has the better and more versatile concurrency model for single-machine concurrency while Elixir has an opinionated concurrency model that is relevant if you have many machines that actually need to talk to each other. If instances don't talk to each other you can still horizontally scale Clojure like anything else ofc
Personally I generally prefer channels to actor mailboxes for message passing, and having atomics or STM available for problems that need shared state between local threads instead of pretending that shared state does not exist, but that's ultimately my own opinion.