Don’t believe in programming gurus! Said that, let’s go to some definitions, and then, take a look at the lies they’ve been told.
Functional programming aims to implement the λ-calculus as a programming environment.
Functional programming (and λ-calculus) is not about using functions, nor even about quitting object orientation.
λ-calculus is about first-class and higher-order functions, and everything as a function. Of course “everything as a function” is a bit radical for the programming context (but not impossible), however every other lambda feature is reasonable to be called functional programming.
First-class function is the one which can be used as parameter or set to a slot. First-class as in “first-class citizen”, with all rights.
Higher-order function is that which takes another one as parameter.
Besides, there are some constraints that define the functional paradigm:
And there are some optional features:
Now that we’ve made those definitions clear, let’s talk about the misconceptions spread through the programmer’s communities – mostly by their very gurus.
You’ve probably heard it.
Ruby isn’t a functional programming, just as Python and Scala are not. Those are object-oriented imperative languages with one or other functional feature, but not enough to be considered even impure functional.
Julia is an impure functional language indeed, but with a lot of imperative features that disfigure its functional trait.
When a guru says that, you can be sure he’s bullshit.
We’ve seen above what functional programming is about.
The logic programming concepts are quite different from functional programming, and deserve a whole dedicated post about. Briefly, it’s about describing the facts’ domain and querying it.
Erlang’s syntax is strongly inspired on Prolog’s, but yet functional. Erlang sticks to all functional constraints and uses some logic features to provide typing, which is a functional feature too – typed lambda, you saw it just above.
Furthermore, Erlang uses the same Prolog’s syntax of defining facts to declare function signatures – not to define facts.
So Erlang isn’t a logic programming language, but a fully functional programming one.
There’s so much more about functional programming, and you should get involved. I recommend taking a look at Haskell for fully funcional programming (install GHC), and Standard ML for impure funcional programming (install MLton).
Also in Medium.