On Mon, May 3, 2010 at 01:24, Robert Dodier <robert.dodier at gmail.com> wrote:
> ...Well, lsum quotes its arguments; I guess the intent is to
> evaluate t only when the list values are known. Seems reasonable.
> A side effect is that nothing else in the first argument gets
> evaluated either. When the list values are unknown,
> should lsum do something like (let (($t '$t)) (meval expr)) ??
> I guess I'm against it -- clever evaluation seems to cause more
> trouble than it's worth; sum being the major example.
>
Robert, as you know, I have also found that clever evaluation schemes cause
more trouble than they're worth.
However, it seems to me that the appropriate 'dumb' evaluation scheme is to
always evaluate all the arguments (like a regular function), not always
quote them. The 'always quote' (fexpr) approach means you have to use
things like ''(...) (in interactive use only) and apply(...), which is
clumsy and confusing.
In interactive use, it is very common to want to operate on a previous
result, e.g.
expr: a[i]$
lsum(expr, i, [u,v] ) => currently gives 2*a[i] ! intended result is
presumably a[u]+a[v]
and in programmatic use, you *invariably* operate on variable arguments.
So it seems to me that lsum should use simple, ordinary, predictable
argument semantics.
-s