Haskell vs. C(gist.github.com)
gist.github.com
Haskell vs. C
https://gist.github.com/dmjio/6166076
3 comments
I believe it is called stream-fusion. The intermediate data-structures are optimized away (since they're unboxed), allowing for faster operations.
I think it would be nice if there will be a world where you can express such a problem in a decidable mini-language where the compiler can deduce that the answer will be n(n+1)/2. :)
You should read the n from the input or given as parameter to the program.