project euler #10: optimization with primes

Daniel Keep daniel.keep.lists at gmail.com
Wed Apr 1 02:58:34 PDT 2009



Robert Fraser wrote:
> bearophile wrote:
>> import d.func, d.primes, d.string;
>> void main() {
>>     const int N = 1_000_000_000;
>>     putr( sum(xtakeWhile((int i){ return i < N;}, xprimes(N))) );
>> }
> 
> Yeah that's shorter (vertically; it's almost as long in characters), but
> how much lisp do you have to smoke to understand it?

None.  It's a straightforward stream operation.

  -- Daniel


More information about the Digitalmars-d-learn mailing list