When comparing Scheme vs Elm, the Slant community recommends Scheme for most people. In the question“What is the best programming language to learn first?” Scheme is ranked 6th while Elm is ranked 17th. The most important reason people chose Scheme is:
Scheme syntax is extremely regular and easy to pick up. A *formal* specification of the syntax fits onto just a few pages; it can be introduced informally in a paragraph or two. Students are not distracted by remembering how to write if statements or loops or even operator precedence because every syntactic follows the same pattern. Ultimately, everything looks something like this: (func a b c) This includes not only user-defined functions but even control flow: (if cond then-clause else-clause) or even primitive operations like `define` and `set`: (define foo 10) (set! foo 11) This means that nothing really has special syntactic treatment in the language. There are essentially no weird edge-cases to memorize, and different concepts are given a more equal weight in the language. (Unlike Algol-like languages which tend to given undue weight to loops and assignment statements, for example.)
Ranked in these QuestionsQuestion Ranking
Pro Simple syntax
Scheme syntax is extremely regular and easy to pick up. A formal specification of the syntax fits onto just a few pages; it can be introduced informally in a paragraph or two. Students are not distracted by remembering how to write if statements or loops or even operator precedence because every syntactic follows the same pattern.
Ultimately, everything looks something like this:
(func a b c)
This includes not only user-defined functions but even control flow:
(if cond then-clause else-clause)
or even primitive operations like
(define foo 10) (set! foo 11)
This means that nothing really has special syntactic treatment in the language. There are essentially no weird edge-cases to memorize, and different concepts are given a more equal weight in the language. (Unlike Algol-like languages which tend to given undue weight to loops and assignment statements, for example.)
Pro No Magic - it's clear how everything works
Scheme has far less built into the language itself, helping students see that things like OOP are not magical: they are just patterns for organizing code. Everything in Scheme is built up from a very small set of primitives which compose in a natural and intuitive fashion.
Having a language that does not accord many things special status helps keep students open minded. This will help students later go between different languages and paradigms from procedural to object-oriented to functional.
Pro Great at teaching fundamental programming ideas
Scheme teaches the important, fundamental ideas immediately without the distraction of unnecessary syntax or language features.
Pro Great, well known textbooks
There is a set of very strong textbooks introducing CS and programming using Scheme. These books are available for free online.
The most famous example--and one of the most famous CS books full stop--is Structure and Interpretation of Computer Programs usually known as SICP. This book introduces fundamental ideas in computer science and covers an incredible amount of material quickly and clearly without requiring any prior knowledge.
However, some people find SICP a bit challenging as a first text. Happily, there are other more introductory texts as well. Simply Scheme is a book designed to be read before SICP, easing beginners into the language as well as CS and programming in general. How to Design Programs is another text used in introductory college courses.
Pro Robust metaprogramming
The quotation functionality of Lisp allow for extremely powerful, yet syntactically straightforward metaprogramming via macros. This is more powerful than the C preprocessor while being less involved than something like Template Haskell or F# quotations.
Using macros to properly decompose a problem domain teaches new developers good habits, improving composibility and reliability when tackling large programs. Scheme metaprogramming also serves as a gentle introduction to domain specific languages.
Pro Multi platform
GNU/Linux, OS X, and Windows versions available.
Unlike most languages, Scheme actually accords both functional programming and imperative programming roughly equal status. Many other languages like Python and Java are staunchly imperative while SML and Haskell are primarily functional; Scheme is a nice middle ground.
Additionally, since Scheme syntax is extremely flexible, it can easily be re-purposed for teaching non-deterministic and logic programming. There is no need to learn a new language like Prolog when the same ideas can easily be expressed with Scheme syntax.
This gives students a good perspective on different ways to think about and organize programs, which makes it much easier to move forward to other languages and technologies.
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 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 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 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 High-level Functional-Reactive Code
Build animations, games, and interactions with an incredibly small amount of terse, readable code.
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 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 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 Not quite Haskell semantics
Pro Batteries included
The Elm Architecture means you don't need to spend valuable time and effort choosing the right frameworks, state management libraries, or build tooling. It's all built in.
Con Little Job Market
There are little to none jobs searching for a Scheme programmer. The ones that exist are more related to Research in Maths or Artificial Intelligence.
Con Fragmented ecosystem
Scheme is an IEEE standard, not an implementation. Unfortunately, the standard is too minimal and practical implementations have diverged--they had to expand on the standard to get anything done, but did so in incompatible ways.
The later de facto standard R6RS tried to correct this, but lost Scheme's minimalist elegance in the process. The newer R7RS standard takes the best of both worlds with an elegant minimalist core and a practical standard library.
Con A language that is purely academic
If someone said "I am starting a project in Scheme" then they are either talking about their homework or they are starting a joke.
Con Very different semantics from mainstream programming languages
Con Lack of typeclasses
Elm doesn't have typeclasses which means some code needs to be duplicated. A fix in a function that needs typeclasses means all of the duplicates need to be fixed too.
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 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.