4 ms·
This is the problem with doing functional list stuff in languages that permit side effects: the order of execution for each function has to be strictly defined
by PaulAJ 13y ago
This is the problem with doing functional list stuff in languages that permit side effects: the order of execution for each function has to be strictly defined (in both senses of the word), so the compiler can't optimise the code. In Haskell the solution (see my comment on the original page) would probably (I haven't actually checked the GHC core output) be folded into a single loop.