%mathpiper,def="ApplyDelta"

/* Tensor package. This code intends to simplify tensorial expressions.
 */

10  # ApplyDelta(_result,Delta(_i,_j)) <--
    DestructiveInsert(result,1,Delta(i,j));
20 # ApplyDelta(_result,(_x) ^ (n_IsInteger))_(n>0) <--
    [
      Local(i);
      For(i:=1,i<=n,i++)
      [
        ApplyDelta(result,x);
      ];
    ];
100 # ApplyDelta(_result,_term) <--
    DestructiveAppend(result,term);

%/mathpiper