[Haskell-beginners] Average of numeric list

David Virebayre dav.vire+haskell at gmail.com
Tue Apr 5 10:58:36 CEST 2011


2011/4/4 Daniel Fischer <daniel.is.fischer at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110405/0ecb3aa9/attachment.htm>


More information about the Beginners mailing list