IMHO the advantages of functional programming is often looked for in examples that are too small for them to exist.
There is no advantage in sorting a billion numbers the functional way.
There is an advantage to gain, though, when the unsorted numbers are used for other purposes besides sorting. Then, functional programming demands that the output of sorting is written to a new 1-billion array instead of "in place", so other clients can consume the same array in parallel without being disturbed by the sorting.
So, deep down in the guts of the language's libraries there must be mutable operations. Which kind of defeats the whole point.
It doesn't defeat the point if the abstraction doesn't leak. If a pure functional language offers sorting as a pure primitive, then language-wise it doesn't matter that it actually mutates memory internally.
The problem with "mostly" pure functional languages is that the abstraction leaks enough to make it useless.
Comments
IMHO the advantages of functional programming is often looked for in examples that are too small for them to exist.
There is no advantage in sorting a billion numbers the functional way.
There is an advantage to gain, though, when the unsorted numbers are used for other purposes besides sorting. Then, functional programming demands that the output of sorting is written to a new 1-billion array instead of "in place", so other clients can consume the same array in parallel without being disturbed by the sorting.
It doesn't defeat the point if the abstraction doesn't leak. If a pure functional language offers sorting as a pure primitive, then language-wise it doesn't matter that it actually mutates memory internally.
The problem with "mostly" pure functional languages is that the abstraction leaks enough to make it useless.
Does this make e.g. erlang useless? Processes have mutable dictionaries and you can perform I/O anywhere in your functions..