On 5/17/09, Barton Willis <willisb at unk.edu> wrote:
> So I looked at how sum and lsum work. It's a mess.
Yeah. I rewrote the sum and product stuff in late 2005 or so after
some discussion about how it should work; in order to make
the index variable act like a local variable, I attempted a scheme
in which the index is replaced by a gensym before evaluating
the summand ... As Barton has pointed out, it yields surprising
results in some cases, and it's possible that the surprises could
be explained away by appealing to the inner workings of the code
(first this one thing happens and then another, etc. Look, it yields
your result!) but aside from that it's so hard to know what to
expect, that at this point I would rather dump the custom
evaluation scheme and make it work like integrate, which doesn't
try to be clever about evaluation.
I suggest that sum, product, & lsum become functions which
evaluate their arguments in the ordinary way.
I'm not opposed to making them simplifying functions, but that
seems to be a separate discussion; integrate isn't, shouldn't
sum/product and integrate all work the same? Or not?
best
Robert Dodier