Don:
> That's not a very useful problem, because the timing depends entirely on 
> BigInt, which is completely unoptimised for small values.

You are usually right, but this time what you say is useless. There are other 
means to judge how good a program is, beside running time:
- Total line count of the program;
- Max amount of memory used.

The Haskell version of the program is quite fast, very short, and it's lazy so 
it uses very low memory. The "Alternate version using "Cyclic Iterators"" 
Python version invented by the great Raymond Hettinger too is lazy and uses 
very low memory. On the other hand, that D version, that I have translated from 
the Java code, is eager so it uses a lot of memory, is slow (mostly because of 
the bigint implementation, I agree), and its source is many lines long. So D 
must do better along one or more than one of those axis.

This huge thread shows that this is a very interesting problem, and solving it 
well is important for a language like that D that wants to support lazy 
iterables a lot in its standard library, and wants to be able to express code 
at a high level too (this means short programs):
http://lambda-the-ultimate.org/node/608

Bye,
bearophile

Reply via email to