variable number of arguments



On Sunday 05 October 2008 09:57:41 pm Richard Fateman wrote:
> The way to do this "correctly" is to use the mma pattern matcher and
> evaluator
> (which I also wrote..., and whose source is in the same directory.).

I was going to get around asking how it might work with macsyma.

> Note that there are many many other options besides f[x_]:=   ...
> and f[x__]:= ...,  like
>
> f[{a_,b_},c_+d__]:=    ...
 
It looks interesting. The Mathematica book gives a sketch of
how to implement symbolic integration with pattern matching.

> If you want to do a partial implementation, restricted mostly to
> arithmetic-like expressions and simple functions, that's ok.  but if you
> are nudging the partial implementation into more and more aspects of
> pattern matching...

Thats a good question. My guess is that the majority of user
code does not take much advantage of pattern matching. For a
reference I am still focusing on a partiuclar user package
of several hundred lines, with the hope that it is somehow
typical. I am not sure yet, but I think it can be done by
handling f[x_] and f[x__]. If too many adhoc solutions to
common situations are required, maybe using pattern matching
is the way to go. But, if this requires essentially creating
another language rather than translating to Maxima, I don't
think I am ready to do that at this point.  However, I will
look at your pattern matcher.

My original idea was to produce a tool for enriching Maxima
in a practical way-- a tool that would translate 'typical'
Mma code say 80 percent correctly with the remaining parts
doable by hand. I prefer this to spending a year making
something that is 50 percent of the way towards duplicating
Mathematica, but which, at the end of the year gives no help
in actually translating or otherwise using a set of
Mathematica functions. Of course having it both ways would
be nice...

John