News for hackers. Stuff that matters.
Re:Notes on Haskell: What's Wrong with the For Loop by jerf on Tuesday March 08, 2011 @09:48PM (#2303579)
"But it does highlight the key failing of for loops: they conflate three separate kinds of operations -- filtering, reduction and transformation."

There's actually four kinds of operations: filtering, reduction, transformation, and good Lord man what the hell are you doing with the loop index? did it just go negative? It did! Why? And it still works‽, which is actually quite hard to simulate with functional programming. Fortunately.

Re:Notes on Haskell: What's Wrong with the For Loop by sqrt17 on Wednesday March 09, 2011 @04:47AM (#2304413)
For the WTF kind of operation, 'while' loops are much more idiomatic - generally, you'd want to use a for loop for things that are minimally recursive (i.e., where you can see, before starting the loop, that the loop body will be executed N, or len(L), or whateverNumberItIs times).
Re:Notes on Haskell: What's Wrong with the For Loop by rtaycher on Wednesday March 09, 2011 @05:44AM (#2304522)
I can top that mine went up to 17 and then jumped to 200 for no obvious reason(some sort of memory bug where memory in a different part of the program overlapped with the loop variable).
Re:Notes on Haskell: What's Wrong with the For Loop by dkersten on Wednesday March 09, 2011 @08:14AM (#2304723)
Did i still work? A bug isn't a fundamental kind of loop operation.