Remix.run Logo
asa400 2 hours ago

> Erlang is, by my accounting, not even a functional langauge at all.

How do you figure?

The essence of FP is functions of the shape `data -> data` rather than `data -> void`, deemphasizing object-based identity, and treating functions as first-class tools for abstraction. There's enough dynamic FP languages at this point to establish that these traits are held in common with the static FP languages. Is Clojure not an FP language?

> It takes more than just having immutable values to be functional, and forcing users to leave varibles as immutable was a mistake, which Elixir fixes.

All data in Elixir is immutable. Bindings can be rebound but the data the bindings point to remains immutable, identical to Erlang.

Elixir just rewrites `x = 1; x = x + 1` to `x1 = 1; x2 = x1 + 1`. The immutable value semantics remain, and anything that sees `x` in between expressions never has its `x` mutated.

> Erlang code in practice is just imperative code written with immutable values, and like a lot of other modern languages, occasional callouts to things borrowed from functional programming like "map", but it is not a functional language in the modern sense.

I did a large amount of Scala prior to doing Erlang/Elixir and while I had a lot of fun with Applicative and Monoid I'm not sure they're the essence of FP. Certainly an important piece of the puzzle but not the totality.

morshu9001 18 minutes ago | parent [-]

Pretty sure FP is exactly what you said, not the presence of higher order functions like map. If it's not, I'm ok calling it a "no variables" language.