News for hackers. Stuff that matters.
Re:Haskell vs. C by venomsnake on Tuesday August 06, 2013 @01:06PM (#6167737)
From what I know about compilers(not much) - when there is calculation without variables they just compute it on the fly and substitute in the code where possible. And I think this is just what is going on.

You should read the n from the input or given as parameter to the program.

Re:Haskell vs. C by dmjio on Tuesday August 06, 2013 @03:05PM (#6168524)
I believe it is called stream-fusion. The intermediate data-structures are optimized away (since they're unboxed), allowing for faster operations.
Re:Haskell vs. C by helloTree on Tuesday August 06, 2013 @03:57PM (#6168773)
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. :)
Re:Haskell vs. C by gems on Tuesday August 06, 2013 @01:27PM (#6167886)
So what was the point?
Re:Haskell vs. C by dmjio on Tuesday August 06, 2013 @03:06PM (#6168527)
To show that haskell and C can achieve equivalent performance on certain numeric calculations.