problem with lists




>
> DistributePlus1(L) :=
>  block (
>   L1 : [], L2 : [] ,
>
>   for i : 1 thru length(L) do
>    (L2 : copylist (L),
>     L2[i] : L2[i]+1,
>     L1 : append(L1, [L2]) ),
>   L1 );

To declare L1 and L2 to be local variables, you'll need something like (insert [ ... ])

DistributePlus1(L) :=block ([L1 : [], L2 : []],
   local(L1,L2),

Also, I inserted local(L1,L2). This prevents Maxima from confusing globally defined undeclared arrays with locally defined lists :(

Not that it really matters, but  "for i : 1 thru length(L) do " recalculates the length of the list for each iteration--it's a tiny bit inefficient.

--Barton