2011/4/4 Daniel Fischer <daniel.is.fischer@googlemail.com>

Note however, that that's not a particularly efficient way to calculate the
mean, since the compiler isn't smart enough to transform it into a loop
traversing the list once (so allowing it to be garbage collected as it is
consumed and the computation to run in constant space) and keeping the
accumulators evaluated.

I've always wondered, is it imaginable that a compiler would be able to do such transforms (assuming very intelligent people (i.e. not me)  have plenty of time to work on it), or is it way too complicated ?

David.