
14 May
2006
14 May
'06
8:25 a.m.
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.