Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

While we are playing this game, here it is in D:

    int total =  recurrence!"n+1"(0)
                .map!(x => x*x)
                .take(10)
                .sum();
Replacing that last sum() with reduce() from std.parellelism and you can sum them using multiple threads (obviously not useful with a set this small but the documentation for reduce() coincidentally includes a benchmark for the sum of squares running 2.5x faster when done in parallel).


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: