`arfreg'
--------

arfreg(NAME,ADD,SUB,MUL,DIV,PWR,CHSGN,COMP)
     :: $B9=B$BN$KBN$9$k4pK\1i;;$rEPO?$9$k(B.

RETURN
     1

NAME
     $BJ8;zNs(B

ADD, SUB, MUL, DIV, PWR, CHSGN, COMP
     $B%f!<%6Dj5A4X?t(B

   * NAME $B$J$k9=B$BN7?$KBP$9$k4pK\1i;;$rEPO?$9$k(B.

   * $B$=$l$>$l$N4X?t$N;EMM$O<!$NDL$j$G$"$k(B.
    ADD(A,B)
          A+B

    SUB(A,B)
          A-B

    MUL(A,B)
          A*B

    DIV(A,B)
          A/B

    PWR(A,B)
          A^B

    CHSGN(A)
          -A

    COMP(A,B)
          1,0,-1 according to the result of a comparison between A and
          B.

     % cat test
     struct a {id,body}$
     
     def add(A,B)
     {
       C = newstruct(a);
       C->id = A->id; C->body = A->body+B->body;
       return C;
     }
     
     def sub(A,B)
     {
       C = newstruct(a);
       C->id = A->id; C->body = A->body-B->body;
       return C;
     }
     
     def mul(A,B)
     {
       C = newstruct(a);
       C->id = A->id; C->body = A->body*B->body;
       return C;
     }
     
     def div(A,B)
     {
       C = newstruct(a);
       C->id = A->id; C->body = A->body/B->body;
       return C;
     }
     
     def pwr(A,B)
     {
       C = newstruct(a);
       C->id = A->id; C->body = A->body^B;
       return C;
     }
     
     def chsgn(A)
     {
       C = newstruct(a);
       C->id = A->id; C->body = -A->body;
       return C;
     }
     
     def comp(A,B)
     {
       if ( A->body > B->body )
         return 1;
       else if ( A->body < B->body )
         return -1;
       else
         return 0;
     }
     
     arfreg("a",add,sub,mul,div,pwr,chsgn,comp)$
     end$
     % asir
     This is Risa/Asir, Version 20000908.
     Copyright (C) FUJITSU LABORATORIES LIMITED.
     1994-2000. All rights reserved.
     [0] load("./test")$
     [11] A=newstruct(a);
     {0,0}
     [12] B=newstruct(a);
     {0,0}
     [13] A->body = 3;
     3
     [14] B->body = 4;
     4
     [15] A*B;
     {0,12}

$B;2>H(B
     *Note `newstruct': newstruct, *Note `$B9=B$BNDj5A(B': $B9=B$BNDj5A(B

