retard wrote:
The discussion here mostly touts imperative languages with the same old
centuries old arguments like "omg functional languages can't do in-place
algorithms". "so you need hacks to implement in-place algorithms. that
must mean that the elegance of fpl is in fact something that cannot be
achieved in real world".
I disagree that this is what this thread is about. FP has a lot of
insight and great ideas to offer programming. The thread is about *bad
examples*, and the FP qsort is a *bad example* of FP programming. Every
paradigm has problems it is ill suited to solve, and FP is ill suited to
implementing qsort.
For another example, around 1990 the programming world decided that OOP
was the solution to all programming problems. One of the results of that
thinking is Java. We've now suffered through the inevitable backlash,
and a more reasoned consensus these days is that OOP is very well suited
to solving some problems, and for other problems one should use a
different paradigm.
As I mentioned to grauzone, D has adopted some essential characteristics
of FP programming (immutability and purity). So, when you're faced with
a programming problem that is ideally suited to an FP solution, you can
do one in D. But you're not forced to use FP for everything, like qsort
and I/O.
Furthermore, an introductory FP programming text should be about how to
write useful programs in FP, not about how sorting algorithms work.
So all the Haskell/Erlang/ML/Scheme books you've read have been really
bad? That only means that there's market for good FPL books, then!
Any FP programming text that puts the one line qsort front and center as
an example of how great FP is is a book that has room for improvement,
you bet.