Re:Notes on Haskell: What's Wrong with the For Loop
by colanderman on Tuesday March 08, 2011 @09:42PM
(#2303563)
You know, he's totally correct (Haskell being lazy and all) but I think he missed the point entirely :P
http://notes-on-haskell.blogspot.com/2007/02/whats-wrong-wit...
"A few people have commented that none of the examples use closures, but in Haskell closures are used not only to represent functions but also unevaluated values (i.e., thunks). For example, in the simple expression
total = sum array
the variable array is free and refers to some value, possibly unevaluated, in the enclosing environment. Until the value of total is evaluated it exists as a thunk that closes over array (and sum, for that matter).
So the examples do indeed use closures.
Cheers! ---Tom"