Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Your favourite Haskell Haikus

Name: Anonymous 2015-03-01 18:12

Post your favourite Haskell Haikus! I'll start:

Prelude> foldl (+) 0 [1..100000000]
<interactive>: out of memory

Prelude> foldr (+) 0 [1..100000000]
<interactive>: out of memory

Prelude> id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id id 1
<interactive>: out of memory

Name: Anonymous 2015-03-01 23:26

>>9
The key to "not actually dying" in foldr is to take advantage the supplied function's associativity. Then substitute a working foldl or do a reasonable parallelization.

In foldl, the runtime should be smarter about pathological laziness (like it seems to be about memoization.) foldl' shouldn't be needed to prevent oom conditions (though I wouldn't get rid of it.)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List