custom plus-like operator



Hello,
I'm sorry I was too hurry first time. 
on Sunday 23 November 2003 21:38 AZ wrote:
>Dobroe vremja sutok, Valery,
>As you might have read, my main concern was to introduce algebraic
>properties for my custom operator. My guess was that I had to define a
>function with the same name, "aa" which would parse its' arguments and
>perform algebraic simplifications needed. 
I see one problem with your definition in the first message.
The infix operator assume at least two arguments.  I can show you the working 
example from my practice. Below I introduce  the anticommutative 
mutliplication operator "&" for the antisymmetirc tensors, 
infix("&");
declare("&",additive); 
"&"(ANY,BODY):=block(local(I),
  L1:first(indices(ANY)), L2:first(indices(BODY)),
  if L1=[] then return(ANY*BODY)
  else if L2=[] then return(ANY*BODY)
  else ( L11 : MAKELIST(DUMMY(), I,1, LENGTH(L1)),
    L22 : MAKELIST(DUMMY(), I,1, LENGTH(L2)),
    L1S:MAP("=",L1,L11), L2S:MAP("=",L2,L22),
    LK1:append(L1,L2),LK2:append(L11,L22),
    ANY:sublis(L1S,ANY), BODY:sublis(L2S,BODY),
    evf:(if evenp(length(LK1)) then 1 else -1),
    contract(canform(
        ratexpand(evf*KDELTA(LK1,LK2)*ANY*BODY/(length(LK1)-1)!)))));

>In reply to your question, I
>would like to see (D4) and (C4) the same in your case. 
Then you should define another aa. If you want to take some algebraic 
simplification at the end you shoud also be more specific and  make 
difference between symbol and number types arguments as well. So just
"aa"(any,body):=block( 
if(symbolp(any) and symbolp(body)) then ......

best rgds,
V