On 2009-12-21 19:13:48 +0100, Andrei Alexandrescu <[email protected]> said:
I disagree. We don't want to educate people to write patently inefficient code and in poor programming practice.

I do not mind it, it's ok for explaining a concept clearly. Of course, inadequacies should also be discussed. I'd argue that these are also the thinking steps normally involved in designing a solution to a problem: first try to solve it in the obvious way to understand the problem. Then, make a more performant implementation. Of course, performant also depends on the context. I have written a lot of C++ code that tries to squeeze the last bit of performance out of the machine in a single-core world, but it is also difficult to parallelize. In a parallel world, the 'slower' solution is sometimes better.

In my mind "elegant" and "at a polynomial blowup in complexity" can't be reconciled anywhere outside a Turing machine introduction where everything is equivalent within a polynomial difference in time and space.

Elegant in the sense of being able to describe a concept briefly. The in-place quicksort does not do this.

I think that's a roundabout way of saying that functional programming is unable to express certain algorithms easily or at all.

...in pure FP. Of course, another problem is that some algorithms are inherently imperative. For instance, I find calculating the edit distance in a performant manner ugly in functional languages.

-- Daniel

Reply via email to