[Haskell-beginners] Performance of Idiomatic lazy Haskell

Stephen Tetley stephen.tetley at gmail.com
Sun Jan 31 14:22:56 EST 2010

On 31 January 2010 18:50, Daniel Fischer <daniel.is.fischer at web.de> wrote:

> Yes. Returning to that,
> a) for tasks where it's appropriate/sufficiently natural, hand-coded loops
> are idiomatic, too.

Indeed - originally I looked at Markus's code and only saw that an
unfoldr would be a natural implementation for the Leibniz generating
function. I overlooked the episilon used to control the accuracy which
pollutes the unfold and makes it no clearer (too much haste / speed on
my part).

>> also the answers are divergent too...
> In how far?

On my machine, they diverged at the eighth decimal place -

Leibniz4 3.1415926526069526
Leibniz1 3.1415926445727678

Best wishes


More information about the Beginners mailing list