edit: s/think/BELIEVE/
edit: s/think/BELIEVE/
"a:b:c".split(":").first # Ruby
vs String.split("a:b:c", ":") |> List.first # Elixir
The length of the two statements is telling. Luckily Elixir has the |> and I don't have to write List.first(String.split("a:b:c", ":"))
OO is generally more convenient to read. It's also more convenient to think into, even when I was young and I looked at C and Lisp without much priming from previous experiences.Functional has other advantages. I quote Joe Armstrong on that: [with OO] "You wanted a banana but what you got was a gorilla holding the banana and the entire jungle." That wasn't much different with plain C though, which could do structs and be somewhat object oriented too if you coded in the right way. And you could end up with a jungle of functions as soon as you write enough modules that need each other.
So Ruby can be very easy to read because you can simply keep appending methods to the right.
In Haskell you can do the same, only you'll prepend functions on the left, so you end up reading expressions from right to left:
(intercalate ", " . map show . Map.elems) myMap
What I find really hard to read, are expressions where the direction of the data flow changes, something that often happens to me in Java: Streams.takeWhile(list.stream().map(e -> f(e)), e -> e.isNeeded())1. Expressiveness is important? Expressiveness is why I don't like Perl.
2. You can certainly implement patterns analogous to OO in functional programming with closures and first-class functions.
3. Reading in the order of execution via chaining is definitely a lot more intuitive than reading from the inside out or right to left.