Beating Decades of Optimized C with 80 Lines of Haskell
Last week he had "Learning Haskell is no harder than learning any other programming language"[1]. This week we have:<p>> The program takes more than a few minutes and quickly spikes up to more than 3 GB of memory! What's gone wrong? Well, we used the strict version of foldl (indicated by the trailing tick '); BUT it's only strict up to "Weak Head Normal Form" (WHNF), which means it'll be strict in the structure of the tuple accumulator, but not the actual values!<p>As easy as any other programming language!<p>[1] <a href="https://news.ycombinator.com/item?id=21170547" rel="nofollow">https://news.ycombinator.com/item?id=21170547</a>