Eugene Crosser wrote:
Anyway, I understand that you used 'seq' in your example as a way to
"strictify" the function that updates accumulator.  Could you (or
anyone) explain (in plain English, preferably:) the reason why 'seq' is
the way it is.  In the first place, why does it have the first argument
at all, and what should you put there?

seq returns its second argument without doing anything to it. As a side-effect, it also evaluates (shallowly) its first argument.

So, first argument should be what you want to be evaluated, second is what you want seq to return.

Note that e `seq` e is useless; it does *not* force the evaluation of e before it would be evaluated in any case.


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to