(%i1) infix("@")$
(%i2) addp(a) := not mapatom(a) and op(a) = "+"$
(%i3) "@"(a,b) := (
a : if addp(a) then args(a) else [a],
b : if addp(b) then args(b) else [b],
apply("+", apply('append,
outermap(lambda([x,y],funmake("@",[x,y])),a,b))))$
(%i4) x @ y;
(%o4) x @ y
(%i5) (a+b) @ x;
(%o5) b @ x + a @ x
(%i6) a @ (x+y+w);
(%o6) a @ y + a @ x + a @ w
(%i7) (a+b+c) @ (p + 6);
(%o7) c @ p + c @ 6 + b @ p + b @ 6 + a @ p + a @ 6
(%i8)
Barton
-----Barton Willis/MATH/UNK/UNEBR wrote: -----
>To: ara@zurich.csail.mit.edu
>From: Barton Willis/MATH/UNK/UNEBR
>Date: 05/17/2005 05:53AM
>cc: maxima@math.utexas.edu
>Subject: Re: [Maxima] Algebra structure
>
># is the name for the not equal function. I
>suggest
>that you use a different name. A function can be
>declared
>additive, but if it is a function of two or more
>arguments, the function is additive in just its
>first argument (as is sum and integrate).
>
>(%i1) infix(@);
>(%o1) @
>
>(%i2) declare("@",additive);
>(%o2) DONE
>
>(%i3) (a+b) @ (c + d);
>(%o3) @(b,d+c)+@(a,d+c)
>(%i4) describe("additive");
>
>......
>
>To make @ multi-additive, you'll need to write
>a definition for @; something like
>
>"@"(a,b) := ....).
>
>Barton