13:32 sum [1..1000000] (N * N + N) / 2 is formula for sum of all numbers from 0 upto N. Why nobody use it? just ONE multiplication, ONE addition and ONE division by 2. NO loop, NO recursion, NO mutable variable. And, in case You don't know this formula, in Haskell it is just one expressive line of code sum [1..1000000] and ghci answer me 500000500000 32:06 About sum of first million even numbers: all numbers is multiple of 2, lets move 2 out or sum. And this is 2 * sum [1..500000], lets plug this in formula, eliminate multiplication by 2 and division by 2, and result is 500000 * 500000 + 500000 ONE multiplication and ONE addition.
Excellent presentation on Haskell pros and cons from a dedicated user and skilled presenter. Highly recommended
Slide trouble until 1:28 ish
great presentation, ty
I learned a lot that I did not know! Very cool.
Great talk, thanks!
Excellent !!!!
Bartosz Milewski was there O_O
13:32 sum [1..1000000]
(N * N + N) / 2 is formula for sum of all numbers from 0 upto N.
Why nobody use it? just ONE multiplication, ONE addition and ONE division by 2. NO loop, NO recursion, NO mutable variable. And, in case You don't know this formula, in Haskell it is just one expressive line of code
sum [1..1000000]
and ghci answer me 500000500000
32:06 About sum of first million even numbers: all numbers is multiple of 2, lets move 2 out or sum. And this is 2 * sum [1..500000], lets plug this in formula, eliminate multiplication by 2 and division by 2, and result is 500000 * 500000 + 500000
ONE multiplication and ONE addition.
I think purely (no other logic) summing of a natural sequence is a very rare case in real-life code and generally using for an idiomatic example.
Здорово гутарит. Неужели наш человек?
poor quality video, don't bother.