July 23, 2015
Thanks to everyone who has picked up a copy of our brand new Elm video tutorial! Since releasing it we've received a bunch of questions and thought we'd roll them all together and answer them here.
Q: What is Elm, in under 144 characters?
Q: What makes it a functional programming language?
A: In simplest terms, Elm programs are a collection of functions. For example, here's a cheery Elm function that transforms one string into another:
greet name = "Howdy, " ++ name ++ "!"
Q: OK, but isn't this just like a method in my object-oriented language?
A: The important difference is Elm functions don't run in the context of an object where they share state with other functions. An Elm function is stateless: it simply transforms its inputs into its output, with no side effects. Given the same inputs, a function always returns the same output.
Q: And that's important because... ?
Well, for starters, it means refactoring is easier because you can move code around without worrying about stuff outside the function. And the code is easier to understand in general. With a stateless function, what you see is what you get.
Q: I heard immutability was also an important part of functional programming. What's Elm got to say about that? ...