Inconsistency when using previously defined variables as arguments to functions



I suspect the biggest problem isn't syntactic, but conceptual.  Can we
really train users to write

     sum( j -> sum ( i -> 1/(i+j), 1:10 ), 1:10 )

instead of

     sum(sum(1/(i+j),i,1,10),j,1,10)

And really, we should also support

     sum( sum ( i -> j-> 1/(i+j), 1:10 ), 1:10 )

where the inner sum would return the function

    j -> 1/(1+j) + 1/(2+j) + ...

That would of course be horribly inefficient if implemented in the
straightforward way....

             -s



On Thu, Jan 27, 2011 at 05:49, Barton Willis <willisb at unk.edu> wrote:
> -----maxima-bounces at math.utexas.edu wrote: -----
>
>>>>?But?the?traditional?lambda?syntax?is?clumsy?and?obscure?to
>>>>?non-computer-scientists.
>>>
>>>?you?could?write??function[k]:k??if?that?would?make?people?happier.
>
> Another possibility:
>
> ?(%i12) (infix("->",50,50), ?"->"(x,f) ::= (x : if listp(x) then x else [x], buildq([x,f], lambda(x,f))))$
>
> ?(%i15) x -> x;
> ?(%o15) lambda([x],x)
>
> ?(%i16) [a,b] -> a+b;
> ?(%o16) lambda([a,b],b+a)
>
> --Barton