Inconsistency when using previously defined variables as arguments to functions



You would write

     sum(lambda([n],sum(lambda([k], k),1,n)),1, m)

But the traditional lambda syntax is clumsy and obscure to
non-computer-scientists.  Maybe it's as easy as defining a nicer
syntax, e.g.

      sum( sum( k // k, 1:n ) // n, 1:m )

But then what do you do when you *do* want to define a function like
sum_over (expr, varlist)?  Do you define yet another syntax for
syntactic lambda-construction?  Do you use subst or buildq (yuck)?  I
suppose that at least moves the complexity to an 'expert' level.

             -s


On Wed, Jan 26, 2011 at 11:29, Barton Willis <willisb at unk.edu> wrote:
> maxima-bounces at math.utexas.edu wrote on 01/26/2011 10:08:18 AM:
>
>> The idea of sum etc taking lambda expressions as arguments is
> intriguing.
>
> It is intriguing, but for double sums, sum would need to return a
> lambda form--otherwise sum(sum(lambda([k], k),1,n),1, m) wouldn't
> work. Alternatively, we'd need a non-nested way to represent multiple
> sums.
>
> I'm OK with sum(lambda([k], k),1,n) --> lambda([k],k*(k+1)/2), but
> that would break stuff.
>
> ---Barton
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>