New function - makelist alternative: table()



Thanks, ?iga, this looks like a nice function.  Thanks for contributing it.

The only incompatibilities I've found so far with makelist are:

        makelist(i,i,a,a+2) => [a, a+1, a+2]
        table(i, [i,a,a+2]) => error
        table(i, [i,%i,%i+2]) => similarly, error
        makelist(a[i],[a[i],2,3]) => [2,3]
        table => error

Some corner cases where I'm not sure what the ideal behavior is:

     table(i,[i,2,3],[i,6,7]) => [[2,2],[3,3]]  (give an error?)

     table( j, [i, 1, 3], [j, 1, i ]) => error  (exchanging i/j gives
the same error)
           (perhaps there should be a standard nesting defined?)

     makelist(i,i,1,0) => []     ... it is useful for the empty case
to be specifiable this way
     table(i,[i,1,0]) => error

A case that works correctly in your code but is not documented in the
opening comment is [var, list].  I'd think that this should work for
sets, too.  The error message also needs to be corrected from "... is
not a number" to "... is not a number, list, or set".

Thanks again for your contribution.

            -s

On Sun, May 10, 2009 at 5:09 AM, ?iga Lenar?i? <ziga.lenarcic at gmail.com> wrote:
> Hi Maxima users and developers!
>
> Dissatisfied with makelist inflexibility, I wrote my own function, table()
> in lisp. It more or less covers all the features of Mathematica's Table[]
> function (hence the name :) ).
>
> I would like this function to be included into Maxima src. How can I do
> that? I'm will write function documentation and unit tests (if they are
> required).