Customizing Maxima. Renaming Maxima functions



On Sept. 25, Richard Hennessy wrote:

>How can you define in Maxima a function called let's say
>foo(e, x) and also have it work for three arguments
>foo(e, x, a, b) ?

Here is a simple example, in which I have used "display"
 just as a debug tool to see what is going on.

(%i1) foo(e,x,[v]) :=  block( [ aa, bb ] ,
         display( v ),
         if length(v) > 0 then aa : v[1],
         if length(v) > 1 then bb : v[2],
         e + x + aa + bb  )$

(%i2) foo( 1, 2 );
                                    v = []

(%o2)                             bb + aa + 3
(%i3) foo( 1, 2, 3 );
                                    v = [3]

(%o3)                               bb + 6
(%i4) foo( 1, 2, 3, 4 );
                                  v = [3, 4]

(%o4)                                 10

To see an extreme example of this kind of allowance for
number and type of arguments, see my maxima code for
qdraw.mac, where the allowed arguments to qdraw(..)
can be entered in any order, and consist of different
types of input.

Ted Woollett
http://www.csulb.edu/~woollett