When comparing Elm vs Clojure, the Slant community recommends Clojure for most people. In the question“What is the best programming language to learn first?” Clojure is ranked 11th while Elm is ranked 17th. The most important reason people chose Clojure is:
Clojure programmers are highly encouraged to use immutable data in their code. Therefore, most data will be immutable by default. State change is handled by functions (for transformations) and atoms (an abstraction that encapsulates the idea of some entity having an identity).
Ranked in these QuestionsQuestion Ranking
Pro No run-time exceptions
Lack of run-time exceptions makes it easy to produce large swathes of reliable front-end code without drowning in tests.
Pro Inferred static typing
ML static typing is great because it's always there, you just choose how explicit you want to be and how much you want the compiler to do.
Pro Designed around high-level front-end development
As Elm was designed as a front-end langauge, it has out of the box support for things like DOM-element creation, letting programmers focus on their application logic, rather than implementation details specific to the web.
Pro Great and simple way to learn Purely Functional Programming
You can try to apply some functional programming ideas in other languages that have an imperative basis, but you haven't seen the real power unless you tried it in the environment of purely functional programming. Elm is a simple language with great learning resources and easy graphical output, which makes it easy to explore the power of functional programming. Plus programming in Elm is very readable.
Pro Growing community
Pro Good documentation
Elm is gaining popularity, somewhat faster than many of the other solutions here. This translates to more code examples, more documentation, and more libraries.
Pro High-level Functional-Reactive Code
Build animations, games, and interactions with an incredibly small amount of terse, readable code.
Pro Super easy refactoring with very helpful compiler errors
In no other language you can refactor so easy without any worries, since the compiler will guide you through. It is like TDD but than compiler-error driven.
Pro Static module system
Elm uses easy to use modules.
import List import List as L import List exposing (..) import List exposing ( map, foldl ) import Maybe exposing ( Maybe ) import Maybe exposing ( Maybe(..) ) import Maybe exposing ( Maybe(Just) )
module MyModule exposing (foo, bar)
Pro Interactive Programming and Hot Swapping
Support for hot swapping and interactive programming is included.
Pro Good tooling
All major editors have great support. With Atom for example, Elm plugins are available for linting, formatting, make/compiler support and Elmjutsu will simply overflow you with super useful functions, like navigate to referenced definition and show expression type.
Pro Missing Syntactic sugar
Easy to learn, most functions have only one way, not 5 alternatives where you must study where to best use what.
Pro Not quite Haskell semantics
Pro Immutability is the default
Clojure programmers are highly encouraged to use immutable data in their code. Therefore, most data will be immutable by default.
State change is handled by functions (for transformations) and atoms (an abstraction that encapsulates the idea of some entity having an identity).
Pro Minimal syntax
Being a LISP, programs are simple: they're just functions and data. That it doesn't get bogged down with syntax or the loftier FP concepts like monads makes it one of most approachable functional languages for beginners.
Pro Tries to solve problems as simply as possible
Simplicity is one of the pillars on which Clojure is built. Clojure tries to solve many problems in software development as simply as possible. Instead of building complex interfaces, objects or factories, it uses immutability and simple data structures.
Pro Good for writing concurrent programs
Since Clojure is designed for concurrency, it offers things like Software Transaction Memory, functional programming without side-effects and immutable data structures right out of the box. This means that the development team can focus their energies on developing features instead of concurrency details.
Pro Huge ecosystem of libraries to work with
There's a very large ecosystem of high-quality Clojure libraries which developers can use. One example is Incanter. It's a great data analytics library and a very powerful tool for dealing with matrices, datasets and csv files.
Pro Cross platform
Clojure compiles to JVM bytecode and runs inside the JVM. This means that applications written in Clojure are cross-platform out of the box.
Pro Rich Hickey
The creator is so awesome, he's a feature. Just look up his talks and see why.
Clojure has an elegant macro system which enables language additions, Domain-specific languages (DSLs), to be created much easier than most other languages (with the exception of Racket, perhaps).
Pro Dynamic language
A superb data processing language. While rich type and specification systems are available they are optional.
Pro Great tool used in automating, configuring and managing dependencies available
Leiningen is a very useful tool for Clojure developers. It helps wiht automation, configuration and dependency management. It's basically a must for every Clojure project.
Pro Game is available with which you can learn Clojure
Nightmod is a tool used to make "live-moddable" games. It displays the game's code while you are playing and allows you to inject new code using Clojure. This can be a fun and useful experience for people trying to learn Clojure.
Pro No C/Java syntax
Con Poor Windows support
Few if any of Elm's core contributors are Windows users and breaking bugs are sometimes left for weeks or months.
Con Adds an additional layer of abstraction
Some users claim that Elm adds an additional layer of abstraction, meaning that it is one more hurdle between the brain and the product.
Con Not database-friendly
It is lots of work to make a server or database your "one source of truth", as Elm makes you write endless JSON parse boilerplate to talk to the server.
Con Confusing error messages
Clojure's error messages more often than not are very confusing. They usually involve stack traces that do not thoroughly explain where the error was caused or what caused it.
Con Tied to the JVM and it's limitations.
Some language constructs were obviously created as workarounds for JVM limitations. This makes the language much less elegant than it could have been.
Also, the JVM has a very cumbersome FFI.
Con Syntax can be alien / jarring for those used to other Lisps
Perhaps some may consider this attribute an advantage, but I do not. Clojure does not attempt to maintain significant compatibility with other Lisps. So, if you already know a Lisp or are used to the way Lisp works in general, you'll probably be confused if you take a look at Clojure. See these resources for more details on this subject: