[BACK]Return to asir.texi CVS log [TXT][DIR] Up to [local] / OpenXM / src / asir-doc / parts

Annotation of OpenXM/src/asir-doc/parts/asir.texi, Revision 1.6

1.6     ! noro        1: @comment $OpenXM: OpenXM/src/asir-doc/parts/asir.texi,v 1.5 2000/09/23 07:53:24 noro Exp $
1.3       noro        2: \BJP
1.1       noro        3: @node $B%f!<%68@8l(B Asir,,, Top
                      4: @chapter $B%f!<%68@8l(B Asir
1.3       noro        5: \E
                      6: \BEG
                      7: @node User language Asir,,, Top
                      8: @chapter User language @b{Asir}
                      9: \E
1.1       noro       10:
                     11: @noindent
1.3       noro       12: \BJP
1.1       noro       13: @b{Asir} $B$NAH$_9~$_H!?t$O(B, $B0x?tJ,2r(B, GCD $B$J$I$N7W;;$r9T$&$b$N(B, $B%U%!(B
                     14: $B%$%kF~=PNO$r9T$&$b$N(B, $B$"$k$$$O?t<0$N0lIt$r<h$j=P$9$b$N$J$I$5$^$6$^$J$b$N(B
                     15: $B$,MQ0U$5$l$F$$$k$,(B, $B%f!<%6$,<B:]$K9T$$$?$$$3$H$r<B9T$5$;$k$?$a$K$O0l(B
                     16: $BHL$K$O%f!<%68@8l$K$h$k%W%m%0%i%`$r=q$/I,MW$,$"$k(B. $B%f!<%68@8l$b(B
                     17: @b{Asir} $B$H8F$P$l$k(B. $B0J2<$G$O(B, $B%f!<%68@8l$NJ8K!5,B'$*$h$S<B:]$N%f!<(B
                     18: $B%68@8l%W%m%0%i%`$rNc$H$7$?%W%m%0%i%`$N=q$-J}$K$D$$$F=R$Y$k(B.
1.3       noro       19: \E
                     20: \BEG
                     21: @b{Asir} provides many built-in functions, which perform algebraic
                     22: computations, e.g., factorization and GCD computation, file I/O,
                     23: extract a part of an algebraic expression, etc.
                     24: In practice, you will often encounter a specific problem for which
                     25: @b{Asir} does not provide a direct solution.  For such cases, you have
                     26: to write a program in a certain user language.  The user language for
                     27: @b{Asir} is also called @b{Asir}.  In the following, we describe the
                     28: Syntax and then show how to write a user program by several examples.
                     29: \E
1.1       noro       30:
                     31: @menu
1.3       noro       32: \BJP
1.1       noro       33: * $BJ8K!(B (C $B8@8l$H$N0c$$(B)::
                     34: * $B%f!<%6Dj5AH!?t$N=q$-J}(B::
1.3       noro       35: \E
                     36: \BEG
                     37: * Syntax (Difference from C language)::
                     38: * Writing user defined functions::
                     39: \E
1.1       noro       40: @end menu
                     41:
                     42:
1.3       noro       43: \BJP
1.1       noro       44: @node $BJ8K!(B (C $B8@8l$H$N0c$$(B),,, $B%f!<%68@8l(B Asir
                     45: @section $BJ8K!(B (C $B8@8l$H$N0c$$(B)
1.3       noro       46: \E
                     47: \BEG
                     48: @node Syntax (Difference from C language),,, User language Asir
                     49: @section Syntax --- Difference from C language
                     50: \E
1.1       noro       51:
                     52: @noindent
1.3       noro       53: \BJP
1.1       noro       54: @b{Asir} $B$NJ8K!$O(B C $B8@8l$K=`5r$7$F$$$k(B.
                     55: $B$*$b$JAj0cE@$O<!$NDL$j$G$"$k(B. $B0J2<$G(B, $BJQ?t$H$O(B @b{Asir} $B$K$*$1$k(B
                     56: $B%W%m%0%i%`MQ$NJQ?t(B, $B$9$J$o$ABgJ8;z$G;O$^$kJ8;zNs$r0UL#$9$k$3$H$H$9$k(B.
1.3       noro       57: \E
                     58: \BEG
                     59: The syntax of @b{Asir} is based on C language.
                     60: Main differences are as follows.
                     61: In this section, a variable does not mean an indeterminate, but
                     62: a program variable which is written by a string which begins with a
                     63: capital alphabetical letter in @b{Asir}.
                     64: \E
1.1       noro       65:
                     66: @itemize @bullet
                     67: @item
1.3       noro       68: \JP $BJQ?t$N7?$,$J$$(B.
                     69: \EG No types for variables.
1.4       noro       70: @*
1.3       noro       71: \BJP
1.1       noro       72: $B4{$K@bL@$7$?$H$*$j(B, @b{Asir} $B$G07$o$l$kBP>]<+?H$OA4$F2?$i$+$N7?(B
                     73: $B$r;}$C$F$$$k(B. $B$7$+$7(B, $B%W%m%0%i%`JQ?t<+BN$O(B, $B$I$N$h$&$JBP>]$G$b(B
                     74: $BBeF~$G$-$k$H$$$&0UL#$G7?$,$J$$$N$G$"$k(B.
1.3       noro       75: \E
                     76: \BEG
                     77: As is already mentioned, any object in @b{Asir} has their respective
                     78: types.  A program variable, however, is type-less, that is, any typed
                     79: object can be assigned to it.
                     80: \E
1.1       noro       81:
                     82: @example
                     83: [0] A = 1;
                     84: 1
                     85: [1] type(A);
                     86: 1
                     87: [2] A = [1,2,3];
                     88: [1,2,3]
                     89: [3] type(A);
                     90: 4
                     91: @end example
                     92:
                     93: @item
1.3       noro       94: \BJP
1.1       noro       95: $BH!?tFb$NJQ?t$O(B, $B%G%U%)%k%H$G$O2>0z?t$r$3$a$F$9$Y$F6I=jJQ?t(B.
1.4       noro       96: @*
1.1       noro       97: $B$?$@$7(B, @code{extern} $B@k8@$5$l$?JQ?t$O(B, $B%H%C%W%l%Y%k$K$*$1$kBg0hJQ?t$H$J$k(B.
                     98: $B$9$J$o$A(B, $BJQ?t$N%9%3!<%W$OBg0hJQ?t$H6I=jJQ?t$N(B 2 $B<oN`$KC1=c2=$5$l$F$$$k(B.
                     99: $B%H%C%W%l%Y%k(B, $B$9$J$o$A%W%m%s%W%H$KBP$7$FF~NO$5$l$?JQ?t$OA4$FBg0hJQ?t(B
                    100: $B$H$7$FEPO?$5$l$k(B. $B$^$?H!?tFb$G$O<!$N$$$:$l$+$H$J$k(B.
1.3       noro      101: \E
                    102: \BEG
                    103: Variables, together with formal parameters, in a function (procedure)
                    104: are all local to the function by default.
1.4       noro      105: @*
1.3       noro      106: Variables can be global at the top level,
                    107: if they are declared with the key word @code{extern}.
                    108: Thus, the scope rule of @b{Asir} is very simple.
                    109: There are only two types of variables: global variables and local
                    110: variables.
                    111: A name that is input to the @b{Asir}'s prompt at the top level
                    112: is denotes a global variable commonly accessed at the top level.
                    113: In a function (procedure) the following rules are applied.
                    114: \E
1.1       noro      115:
                    116: @enumerate
                    117: @item
1.3       noro      118: \BJP
1.1       noro      119: $BH!?t$,Dj5A$5$l$k%U%!%$%k$K$*$$$F(B, $B$=$NH!?tDj5A0JA0$K(B, $B$"$k(B
                    120: $BJQ?t$,(B @code{extern} $B@k8@$5$l$F$$$k>l9g(B, $BH!?tFb$N$=$NJQ?t$bBg0hJQ?t(B
                    121: $B$H$7$F07$o$l$k(B.
1.3       noro      122: \E
                    123: \BEG
                    124: If a variable is declared as global by an @code{extern} statement in
                    125: a function, the variable used in that function denotes a global variable
                    126: at the top level.
                    127: Furthermore, if a variable in a function is preceded by an @code{extern}
                    128: declaration outside the function but in a file where the function is
                    129: defined, all the appearance of that variable in the same file denote
                    130: commonly a global variable at the top level.
                    131: \E
                    132:
                    133: @item
                    134: \JP @code{extern} $B@k8@$5$l$F$$$J$$JQ?t$O$=$NH!?t$K6I=jE*$H$J$k(B.
                    135: \BEG
                    136: A variable in a function is local to that function, if it is not declared
                    137: as global by an @code{extern} declaration.
                    138: \E
1.1       noro      139: @end enumerate
                    140:
                    141: @example
                    142: % cat afo
                    143: def afo() @{ return A;@}
                    144: extern A$
                    145: def bfo() @{ return A;@}
                    146: end$
                    147: % asir
                    148: [0] load("afo")$
                    149: [5] A = 1;
                    150: 1
                    151: [6] afo();
                    152: 0
                    153: [7] bfo();
                    154: 1
                    155: @end example
                    156:
                    157: @item
1.3       noro      158: \JP $B%W%m%0%i%`JQ?t$OBgJ8;z$G;O$^$j(B, $BITDj85(B, $BH!?t$O>.J8;z$G;O$^$k(B.
                    159: \EG Program variables and algebraic indeterminates are distinguished in @b{Asir}.
1.4       noro      160: @*
1.3       noro      161: \BJP
1.1       noro      162: $B$3$NE@$O(B, $B4{B8$N?t<0=hM}%7%9%F%`$N$[$H$s$I$H0[$J$kE@$G$"$k(B. @b{Asir}
                    163: $B$,$3$N;EMM$r:NMQ$7$?$N$O(B, $B%f!<%6$,ITDj85$N$D$b$j$G;HMQ$7$?JQ?t$K(B
                    164: $B$J$s$i$+$NCM$,BeF~$5$l$F$$$?>l9g$K:.Mp$r>7$/(B, $B$H$$$&(B, $B4{B8$N(B
                    165: $B%7%9%F%`$K$"$j$,$A$J>u67$rHr$1$k$?$a$G$"$k(B.
1.3       noro      166: \E
                    167: \BEG
                    168: The names of program variables must begin with a capital letter;
                    169: while the names of indeterminates and functions must begin with
                    170: a small letter.
                    171:
                    172: This is an unique point that differs from almost all other existing
                    173: computer algebra systems.  The distinction between program variables
                    174: and indeterminates is adopted to avoid the possible and usual confusion
                    175: that may arise in a situation where a name is used as an indeterminate
                    176: but, as it was, the name has been already assigned some value.
                    177: To use different type of letters, capital and small, was a matter of
                    178: syntactical convention like Prolog, but it is convenient to distinguish
                    179: variables and indeterminates in a program.
                    180: \E
                    181:
                    182: @item
                    183: \JP @code{switch} $BJ8(B, @code{goto} $B$,$J$$(B.
                    184: \EG No @code{switch} statements, and @code{goto} statements.
1.4       noro      185: @*
1.3       noro      186: \JP @code{goto} $B$,$J$$$?$a(B, $BB?=E%k!<%W$r0lEY$KH4$1$k$N$,$d$dJ#;($K$J$k>l9g$,$"$k(B.
                    187: \EG Lack of @code{goto} statement makes it rather bothering to exit from within multiple loops.
                    188:
                    189: @item
                    190: \BJP
                    191: $B%3%s%^<0$O(B, @code{for (A;B;C)} $B$^$?$O(B, @code{while(A)} $B$N(B @code{A},
                    192: @code{B}, @code{C} $B$K$N$_;H$&$3$H$,$G$-$k(B.
                    193: \E
                    194: \BEG
                    195: Comma expressions are allowed only in @code{A}, @code{B} and @code{C}
                    196: of the constructs @code{for (A;B;C)} or @code{while(A)}.
                    197: \E
1.4       noro      198: @*
1.3       noro      199: \JP $B$3$l$O(B, $B%j%9%H$r@5<0$J%*%V%8%'%/%H$H$7$F2C$($?$3$H$K$h$k(B.
                    200: \EG This limitation came from adopting lists as legal data objects for @b{Asir}.
1.1       noro      201:
                    202: @end itemize
                    203:
                    204: @noindent
1.3       noro      205: \JP $B0J>e$O@)8B$G$"$k$,(B, $B3HD%$H$7$F$O<!$NE@$,5s$2$i$l$k(B.
                    206: \EG The above are limitations; extensions are listed as follows.
1.1       noro      207:
                    208: @itemize @bullet
                    209: @item
1.3       noro      210: \JP $BM-M}<0$KBP$9$k7W;;$r(B, $BDL>o$N(B C $B$K$*$1$k7W;;$HF1MM$K$G$-$k(B.
                    211: \BEG
                    212: Arithmetic for rational expressions can be done in the
                    213: same manner as is done for numbers in C language.
                    214: \E
1.1       noro      215:
                    216: @item
1.3       noro      217: \JP $B%j%9%H$,07$($k(B.
                    218: \EG Lists are available for data objects.
1.1       noro      219:
1.3       noro      220: \BJP
1.1       noro      221: $B9=B$BN$rMQ$$$k$^$G$b$J$$MWAG$N=89gBN$r(B, $B%j%9%H$GI=$9$3$H$,$G$-(B,
                    222: C $B$GD>@\=q$/>l9g$KHf3S$7$F%W%m%0%i%`$,C;$/(B, $BFI$_$d$9$/=q$1$k(B.
1.3       noro      223: \E
                    224: \BEG
                    225: Lists are conveniently used to represent a certain collection of objects.
                    226: Use of lists enables to write programs more easily, shorter and more
                    227: comprehensible than use of structure like C programs.
                    228: \E
1.2       noro      229:
                    230: @item
1.3       noro      231: \JP $B%f!<%6Dj5AH!?t$K$*$1$k%*%W%7%g%s;XDj(B.
                    232: \EG Options can be specified in calling user defined functions.
1.2       noro      233:
1.3       noro      234: \JP $B$3$l$K4X$7$F$O(B, @xref{$B%*%W%7%g%s;XDj(B}.
                    235: \EG @xref{option}.
1.1       noro      236: @end itemize
                    237:
1.3       noro      238: \BJP
1.1       noro      239: @node $B%f!<%6Dj5AH!?t$N=q$-J}(B,,, $B%f!<%68@8l(B Asir
                    240: @section $B%f!<%6Dj5AH!?t$N=q$-J}(B
1.3       noro      241: \E
                    242: \BEG
                    243: @node Writing user defined functions,,, User language Asir
                    244: @section Writing user defined functions
                    245: \E
1.1       noro      246:
                    247: @menu
1.3       noro      248: \BJP
1.1       noro      249: * $B%f!<%6Dj5AH!?t(B::
                    250: * $BJQ?t$*$h$SITDj85(B::
                    251: * $B0z?t(B::
                    252: * $B%3%a%s%H(B::
                    253: * $BJ8(B::
                    254: * return $BJ8(B::
                    255: * if $BJ8(B::
                    256: * $B%k!<%W(B break return continue::
1.5       noro      257: * $B9=B$BNDj5A(B::
1.1       noro      258: * $B$5$^$6$^$J<0(B::
                    259: * $B%W%j%W%m%;%C%5(B::
1.2       noro      260: * $B%*%W%7%g%s;XDj(B::
1.3       noro      261: \E
                    262: \BEG
                    263: * User defined functions::
                    264: * variables and indeterminates::
                    265: * parameters and arguments::
                    266: * comments::
                    267: * statements::
                    268: * return statement::
                    269: * if statement::
                    270: * loop break return continue::
1.5       noro      271: * structure definition::
1.3       noro      272: * various expressions::
                    273: * preprocessor::
                    274: * option::
                    275: \E
1.1       noro      276: @end menu
                    277:
1.3       noro      278: \BJP
1.1       noro      279: @node $B%f!<%6Dj5AH!?t(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
                    280: @subsection $B%f!<%6Dj5AH!?t(B
1.3       noro      281: \E
                    282: \BEG
                    283: @node User defined functions,,, Writing user defined functions
                    284: @subsection User defined functions
                    285: \E
1.1       noro      286:
                    287: @noindent
1.3       noro      288: \BJP
1.1       noro      289: $B%f!<%6$K$h$kH!?t$NDj5A$O(B @samp{def} $BJ8$G9T$&(B. $BJ8K!%(%i!<$OFI$_9~$_;~$K(B
                    290: $B$"$kDxEY%A%'%C%/$5$l(B, $B$*$*$h$=$N>l=j$,I=<($5$l$k(B.
                    291: $B4{$K(B($B0z?t$N8D?t$K4X78$J$/(B)$BF1L>$NH!?t$,Dj5A$5$l$F$$$k>l9g$K$O(B,
                    292: $B$=$NH!?t$O:FDj5A$5$l$k(B. @code{ctrl()} $BH!?t$K$h$j(B @code{verbose} $B%U%i%0(B
                    293: $B$,(B on $B$K$J$C$F$$$k>l9g(B,
1.3       noro      294: \E
                    295: \BEG
                    296: To define functions by an user himself, @samp{def} statement must be used.
                    297: Syntactical errors are detected in the parsing phase
                    298: of @b{Asir}, and notified with an indication of where @b{Asir} found the error.
                    299: If a function with the same name is already defined (regardless to
                    300: its arity,) the new definition will override the old one, and the user
                    301: will be told by a message,
                    302: \E
1.1       noro      303:
                    304: @example
                    305: afo() redefined.
                    306: @end example
                    307:
                    308: @noindent
1.3       noro      309: \BJP
1.1       noro      310: $B$H$$$&%a%C%;!<%8$,I=<($5$l$k(B. $B$"$kH!?t$NDj5A$K$*$$$F(B, $B$^$@L$Dj5A$NH!?t(B
                    311: $B$r8F$S=P$7$F$$$F$b(B, $BDj5A;~$K$O%(%i!<$K$J$i$J$$(B. $B<B9T;~$KL$Dj5A$NH!?t(B
                    312: $B$r8F$S=P$=$&$H$7$?>l9g$K%(%i!<$H$J$k(B.
1.3       noro      313: \E
                    314: \BEG
                    315: on the screen when a flag @code{verbose} is set to a non-zero value by
                    316: @code{ctrl()}.
                    317: Recursive definition, and of course, recursive use of functions are
                    318: available.
                    319: A call for an yet undefined function in a function definition is not
                    320: detected as an error.  An error will be detected at execution of the
                    321: call of that yet undefined function.
                    322: \E
1.1       noro      323: @example
                    324: @tex
                    325: /* $X!$ */
                    326: @end tex
                    327:
                    328: def f(X) @{
                    329:     if ( !X )
                    330:         return 1;
                    331:     else
                    332:         return X * f(X-1);
                    333: @}
                    334:
                    335: @tex
1.3       noro      336: \JP /* ${_i}C_j ( 0 \le i \le N, 0 \le j \le i )$ */
                    337: \EG /* ${_i}C_j ( 0 \le i \le N, 0 \le j \le i )$ */
1.1       noro      338: @end tex
                    339:
                    340: def c(N)
                    341: @{
                    342:     A = newvect(N+1); A[0] = B = newvect(1); B[0] = 1;
                    343:     for ( K = 1; K <= N; K++ ) @{
                    344:         A[K] = B = newvect(K+1); B[0] = B[K] = 1;
                    345:         for ( P = A[K-1], J = 1; J < K; J++ )
                    346:             B[J] = P[J-1]+P[J];
                    347:         @}
                    348:     return A;
                    349: @}
                    350: @end example
                    351:
                    352: @noindent
1.3       noro      353: \BJP
1.1       noro      354: 2 $B$DL\$NNc$G$O(B, $BD9$5(B @code{N+1} $B$N%Y%/%H%k(B (@code{A}$B$H$9$k(B) $B$,JV$5$l$k(B.
                    355: @code{A[I]} $B$OD9$5(B @code{I+1} $B$NG[Ns$G$"$j(B, $B$=$N$=$l$>$l$NMWAG$,(B
1.3       noro      356: \E
                    357: \BEG
                    358: In the second example, @code{c(N)} returns a vector, say @code{A}, of length
                    359: @code{N+1}.  @code{A[I]} is a vector of length @code{I+1}, and
                    360: each element is again a vector which contains
                    361: \E
1.1       noro      362: @iftex
                    363: @tex
                    364: ${_I}C_J$
                    365: @end tex
                    366: @end iftex
                    367: @ifinfo
                    368: ICJ
                    369: @end ifinfo
1.3       noro      370: \JP $B$rMWAG$H$9$kG[Ns$G$"$k(B.
                    371: \EG as its elements.
1.1       noro      372:
                    373: @noindent
1.3       noro      374: \BJP
1.1       noro      375: $B0J2<$G$O(B, C $B$K$h$k%W%m%0%i%_%s%0$N7P83$,$J$$?M$N$?$a$K(B, @b{Asir} $B8@8l(B
                    376: $B$K$h$k%W%m%0%i%`$N=q$-J}$r2r@b$9$k(B.
1.3       noro      377: \E
                    378: \BEG
                    379: In the following, the manner of writing @b{Asir} programs is exhibited
                    380: for those who have no experience in writing C programs.
                    381: \E
1.1       noro      382:
1.3       noro      383: \BJP
1.1       noro      384: @node $BJQ?t$*$h$SITDj85(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
                    385: @subsection $BJQ?t$*$h$SITDj85(B
1.3       noro      386: \E
1.1       noro      387:
                    388: @noindent
1.3       noro      389: \BJP
1.1       noro      390: $B4{$K=R$Y$?DL$j(B, @b{Asir} $B$K$*$$$F$O%W%m%0%i%`JQ?t$HITDj85$rL@3N$K(B
                    391: $B6hJL$7$F$$$k(B.
1.3       noro      392: \E
                    393: \BEG
                    394: @node variables and indeterminates,,, Writing user defined functions
                    395: @subsection variables and indeterminates
                    396: \E
1.1       noro      397:
                    398: @table @b
1.3       noro      399: \BJP
1.1       noro      400: @item $BJQ?t(B
                    401: $BBgJ8;z$G;O$^$j(B, $B%"%k%U%!%Y%C%H(B, $B?t;z(B, @samp{_} $B$+$i$J$kJ8;zNs(B
1.3       noro      402: \E
                    403: \BEG
                    404: @item variables (program variables)
                    405: A program variable is a string that begins with a capital
                    406: alphabetical letter followed by any numbers of alphabetical letters,
                    407: digits and @samp{_}.
                    408: \E
1.1       noro      409:
1.3       noro      410: \BJP
1.1       noro      411: $BJQ?t$"$k$$$O%W%m%0%i%`JQ?t$H$O(B, @b{Asir} $B$N$5$^$6$^$J7?$NFbIt7A<0$r(B
                    412: $B3JG<$9$k$?$a$NH"$G$"$j(B, $B3JG<$5$l$?FbIt7A<0$,(B, $B$3$NJQ?t$NCM$G$"$k(B.  $BJQ(B
                    413: $B?t$,<0$NMWAG$H$7$FI>2A$5$l$k;~$O(B, $B$=$3$K<}$a$i$l$?CM$KCV$-49$($i$l$k(B.
                    414: $B$9$J$o$A(B, $BFbIt7A<0$NCf$K$O%W%m%0%i%`JQ?t$O8=$l$J$$(B. $BJQ?t$OA4$F(B 0 $B$G(B
                    415: $B=i4|2=$5$l$F$$$k(B.
1.3       noro      416: \E
                    417: \BEG
                    418: A program variable is thought of a box (a carrier) which can contain
                    419: @b{Asir} objects of various types.  The content is called the `value'
                    420: of that variable.  When an expression in a program is to be evaluated,
                    421: the variable appearing in the expression is first replaced by its value
                    422: and then the expression is evaluated to some value and stored in
                    423: the memory.  Thus, no program variable appears in objects in the
                    424: internal form.
                    425: All the program variables are initialized to the value 0.
                    426: \E
1.1       noro      427:
                    428: @example
                    429: [0] X^2+X+1;
                    430: 1
                    431: [1] X=2;
                    432: 2
                    433: [2] X^2+X+1;
                    434: 7
                    435: @end example
                    436:
1.3       noro      437: \BJP
1.1       noro      438: @item $BITDj85(B
                    439: $B>.J8;z$G;O$^$j(B, $B%"%k%U%!%Y%C%H(B, $B?t;z(B, @samp{_} $B$+$i$J$kJ8;zNs(B
                    440:
                    441: $BITDj85$H$O(B, $BB?9`<04D$r9=@.$9$k:]$KE:2C$5$l$kJQ?t$r$$$&(B. @b{Asir} $B$K(B
                    442: $B$*$$$F$O(B, $BITDj85$OCM$r$b$?$J$$D61[E*$J85$G$"$j(B, $BITDj85$X$NCM$NBeF~$O(B
                    443: $B5v$5$l$J$$(B.
1.3       noro      444: \E
                    445: \BEG
                    446: @item indeterminates
                    447: An indeterminate is a string that begins with a small alphabetical letter
                    448: followed by any numbers of alphabetical letters, digits and @samp{_}.
                    449:
                    450: An indeterminate is a transcendental element, so-called variable,
                    451: which is used to construct polynomial rings.
                    452: An indeterminate cannot have any value.  No assignment is allowed to it.
                    453: \E
1.1       noro      454:
                    455: @example
                    456: [3] X=x;
                    457: x
                    458: [4] X^2+X+1;
                    459: x^2+x+1
                    460: @end example
                    461: @end table
                    462:
1.3       noro      463: \BJP
1.1       noro      464: @node $B0z?t(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
                    465: @subsection $B0z?t(B
1.3       noro      466: \E
                    467: \BEG
                    468: @node parameters and arguments,,, Writing user defined functions
                    469: @subsection parameters and arguments
                    470: \E
1.1       noro      471:
                    472: @example
                    473: def sum(N) @{
                    474:     for ( I = 1, S = 0; I <= N; I++ )
                    475:         S += I;
                    476:     return S;
                    477: @}
                    478: @end example
                    479:
                    480: @noindent
1.3       noro      481: \BJP
1.1       noro      482: $B$3$l$O(B, 1 $B$+$i(B @code{N} $B$^$G$N<+A3?t$NOB$r5a$a$kH!?t(B @code{sum()} $B$N(B
                    483: $BDj5A$G$"$k(B. $B$3$NNc$K$*$1$k(B @code{sum(N)} $B$N(B @code{N} $B$,0z?t$G$"$k(B.
                    484: $B$3$NNc$O(B, 1 $B0z?tH!?t$NNc$G$"$k$,(B, $B0lHL$K0z?t$N8D?t$OG$0U$G$"$j(B,
                    485: $BI,MW$J$@$1$N8D?t$r(B @samp{,} $B$G6h@Z$C$F;XDj$9$k$3$H$,$G$-$k(B. $B0z?t$O(B
                    486: $BCM$,EO$5$l$k(B. $B$9$J$o$A(B, $B0z?t$r<u$1$H$C$?B&$,(B, $B$=$N0z?t$NCM$rJQ99$7$F(B
                    487: $B$b(B, $BEO$7$?B&$NJQ?t$OJQ2=$7$J$$(B. $B$?$@$7(B, $BNc30$,$"$k(B. $B$=$l$O(B, $B%Y%/%H%k(B,
                    488: $B9TNs$r0z?t$KEO$7$?>l9g$G$"$k(B. $B$3$N>l9g$b(B, $BEO$5$l$?JQ?t$=$N$b$N$r=q$-(B
                    489: $BBX$($k$3$H$O(B, $B$=$NH!?t$K6I=jE*$JA`:n$G$"$k$,(B, $BMWAG$r=q$-49$($?>l9g(B,
                    490: $B$=$l$O(B, $B8F$S=P$7B&$N%Y%/%H%k(B, $B9TNs$NMWAG$r=q$-49$($k$3$H$K$J$k(B.
1.3       noro      491: \E
                    492: \BEG
                    493: This is an example definition of a function that sums up integers
                    494: from 1 to @code{N}.  The @code{N} in @code{sum(N)} is called the
                    495: (formal) parameter of @code{sum(N)}.
                    496: The example shows a function of the single argument.
                    497: In general, any number of parameters can be specified by separating
                    498: by commas (@samp{,}).
                    499: A (formal) parameter accepts a value given as an argument (or an actual
                    500: parameter) at a function call of the function.
                    501: Since the value of the argument is given to the formal parameter,
                    502: any modification to the parameter does not usually affect the argument
                    503: (or actual parameter).  However, there are a few exceptions: vector
                    504: arguments and matrix arguments.
                    505:
                    506: Let @code{A} be a program variable and assigned to a vector value
                    507: @code{[ a, b ]}.
                    508: If A is given as an actual parameter to a formal parameter, say @code{V},
                    509: of a function, then an assignment in the function to the vector element
                    510: designator @code{V[1]}, say @code{V[1]=c;}, causes modification of the
                    511: actual parameter @code{A} resulting @code{A} to have an altered value
                    512: @code{[ a c ]}.  Thus, if a vector is given to a formal parameter of
                    513: a function, then its element (and subsequently the vector itself) in
                    514: the calling side is modified through modification of the formal parameter
                    515: by a vector element designator in the called function.
                    516: The same applies to a matrix argument.
                    517: Note that, even in such case where a vector (or a matrix) is given to
                    518: a formal parameter, the assignment to the whole parameter itself has
                    519: only a local effect within the function.
                    520: \E
1.1       noro      521:
                    522: @example
                    523: def clear_vector(M) @{
                    524:     /* M is expected to be a vector */
                    525:     L = size(M)[0];
                    526:     for ( I = 0; I < L; I++ )
                    527:         M[I] = 0;
                    528: @}
                    529: @end example
                    530:
                    531: @noindent
1.3       noro      532: \BJP
1.1       noro      533: $B$3$NH!?t$O(B, $B0z?t$N%Y%/%H%k$r(B 0 $B%Y%/%H%k$K=i4|2=$9$k$?$a$NH!?t$G$"$k(B.
                    534: $B$^$?(B, $B%Y%/%H%k$r0z?t$KEO$9$3$H$K$h$j(B, $BJ#?t$N7k2L$r0z?t$N%Y%/%H%k$K(B
                    535: $B<}G<$7$FJV$9$3$H$,$G$-$k(B. $B<B:]$K$O(B, $B$3$N$h$&$J>l9g$K$O(B, $B7k2L$r%j%9%H(B
                    536: $B$K$7$FJV$9$3$H$b$G$-$k(B. $B>u67$K1~$8$F;H$$$o$1$9$k$3$H$,K>$^$7$$(B.
1.3       noro      537: \E
                    538: \BEG
                    539: This function will clear off the vector given as its argument to the
                    540: formal parameter @code{M} and return a 0 vector.
                    541:
                    542: Passing a vector as an argument to a function enables returning
                    543: multiple results by packing each result in a vector element.
                    544: Another alternative to return multiple results is to use a list.
                    545: Which to use depends on cases.
                    546: \E
1.1       noro      547:
1.3       noro      548: \BJP
1.1       noro      549: @node $B%3%a%s%H(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
                    550: @subsection $B%3%a%s%H(B
1.3       noro      551: \E
                    552: \BEG
                    553: @node comments,,, Writing user defined functions
                    554: @subsection comments
                    555: \E
1.1       noro      556:
                    557: @noindent
1.3       noro      558: \JP C $B$HF1MM(B @samp{/*} $B$H(B @samp{*/} $B$G0O$^$l$?ItJ,$O%3%a%s%H$H$7$F07$o$l$k(B.
                    559: \BEG
                    560: The text enclosed by @samp{/*} and @samp{*/} (containing @samp{/*} and
                    561: @samp{*/}) is treated as a comment and has no effect to the program
                    562: execution as in C programs.
                    563: \E
1.1       noro      564:
                    565: @example
                    566: /*
                    567:  * This is a comment.
                    568:  */
                    569:
                    570: def afo(X) @{
                    571: @end example
                    572:
                    573: @noindent
1.3       noro      574: \BJP
1.1       noro      575: $B%3%a%s%H$OJ#?t9T$KEO$C$F$b9=$o$J$$$,(B, $BF~$l;R$K$9$k$3$H$O$G$-$J$$(B.
                    576: @samp{/*} $B$,$$$/$D$"$C$F$b:G=i$N$b$N$N$_$,M-8z$H$J$j(B, $B:G=i$K8=$l$?(B
                    577: @samp{*/} $B$G%3%a%s%H$O=*N;$7$?$H8+$J$5$l$k(B. $B%W%m%0%i%`$J$I$G(B, $B%3%a%s%H(B
                    578: $B$r4^$`2DG=@-$,$"$kItJ,$r%3%a%s%H%"%&%H$7$?>l9g$K$O(B, @code{#if 0},
1.6     ! noro      579: @code{#endif}$B$r;H$($P$h$$(B. (@xref{$B%W%j%W%m%;%C%5(B}.)
1.3       noro      580: \E
                    581: \BEG
                    582: A comment can span to several lines, but it cannot be nested.
                    583: Only the first @samp{/*} is effective no matter how many @samp{/*}'s
                    584: in the subsequent text exist, and the comment terminates at the first
                    585: @samp{*/}.
                    586:
                    587: In order to comment out a program part that may contain comments in it,
1.6     ! noro      588: use the pair, @code{#if 0} and @code{#endif}. (@xref{preprocessor}.)
1.3       noro      589: \E
1.1       noro      590:
                    591: @example
                    592: #if 0
                    593: def bfo(X) @{
                    594: /* empty */
                    595: @}
                    596: #endif
                    597: @end example
                    598:
1.3       noro      599: \BJP
1.1       noro      600: @node $BJ8(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
                    601: @subsection $BJ8(B
1.3       noro      602: \E
                    603: \BEG
                    604: @node statements,,, Writing user defined functions
                    605: @subsection statements
                    606: \E
1.1       noro      607:
                    608: @noindent
1.3       noro      609: \BJP
1.1       noro      610: @b{Asir} $B$N%f!<%6H!?t$O(B,
                    611:
                    612: @example
                    613: def $BL>A0(B($B0z?t(B,$B0z?t(B,...,$B0z?t(B) @{
                    614:     $BJ8(B
                    615:     $BJ8(B
                    616:     ...
                    617:     $BJ8(B
                    618: @}
1.3       noro      619: \E
                    620: \BEG
                    621: An user function of @b{Asir} is defined in the following form.
                    622:
                    623: @example
                    624: def name(parameter, parameter,...,parameter) @{
                    625:     statement
                    626:     statement
                    627:     ...
                    628:     statement
                    629: @}
                    630: \E
1.1       noro      631: @end example
                    632:
                    633: @noindent
1.3       noro      634: \BJP
1.1       noro      635: $B$H$$$&7A$GDj5A$5$l$k(B. $B$3$N$h$&$K(B, $BJ8$OH!?t$N4pK\E*9=@.MWAG$G$"$j(B, $B%W%m(B
                    636: $B%0%i%`$r=q$/$?$a$K$O(B, $BJ8$,$I$N$h$&$J$b$N$G$"$k$+CN$i$J$1$l$P$J$i$J$$(B.
                    637: $B:G$bC1=c$JJ8$H$7$F(B, $BC1J8$,$"$k(B. $B$3$l$O(B,
1.3       noro      638: \E
                    639: \BEG
                    640: As you can see, the statement is a fundamental element of the
                    641: function.
                    642: Therefore, in order to write a program, you have to learn what
                    643: the statement is.  The simplest statement is the simple statement.
                    644: One example is an expression with a terminator (@samp{;} or @samp{$}.)
                    645: \E
1.1       noro      646:
                    647: @example
                    648: S = sum(N);
                    649: @end example
                    650:
                    651: @noindent
1.3       noro      652: \BJP
1.1       noro      653: $B$N$h$&$K(B, $B<0$K=*C<5-9f(B (@samp{;} $B$^$?$O(B @samp{$}) $B$r$D$1$?$b$N$G$"$k(B.
                    654: $B$3$NC1J85Z$SN`;w$N(B @code{return} $BJ8(B, @code{break} $BJ8$J$I$,J8$N:G>.9=@.(B
1.6     ! noro      655: $BC10L$H$J$k(B. @code{if} $BJ8$d(B @code{for} $BJ8$NDj5A(B (@ref{$BJ8K!$N>\:Y(B}) $B$r8+$l(B
1.1       noro      656: $B$P$o$+$kDL$j(B, $B$=$l$i$NK\BN$O(B, $BC1$J$k0l$D$NJ8$H$7$FDj5A$5$l$F$$$k(B. $BDL>o(B
                    657: $B$O(B, $BK\BN$K$OJ#?t$NJ8$,=q$1$k$3$H$,I,MW$H$J$k(B.  $B$3$N$h$&$J>l9g(B,
                    658: @samp{@{} $B$H(B @samp{@}} $B$GJ8$NJB$S$r3g$C$F(B, $B0l$D$NJ8$H$7$F07$&$3$H$,$G(B
                    659: $B$-$k(B. $B$3$l$rJ#J8$H8F$V(B.
1.3       noro      660: \E
                    661: \BEG
                    662: A `@code{return} statement' and `@code{break} statement' are also
                    663: primitives to construct `statements.'
                    664: As you can see the syntactic definition of `@code{if} statement' and
                    665: `@code{for} statement', each of their bodies consists of a single
                    666: `statement.'  Usually, you need several statements in such a body.
                    667: To solve this contradictory requirement, you may use the `compound
                    668: statement.'  A `compound statement' is a sequence of `statement's
                    669: enclosed by a left brace @samp{@{} and a right brace @samp{@}}.
                    670: Thus, you can use multiple statement as if it were a single statement.
                    671: \E
1.1       noro      672:
                    673: @example
                    674: if ( I == 0 ) @{
                    675:     J = 1;
                    676:     K = 2;
                    677:     L = 3;
                    678: @}
                    679: @end example
                    680:
                    681: @noindent
1.3       noro      682: \BJP
1.1       noro      683: @samp{@}} $B$N8e$m$K$O=*C<5-9f$OI,MW$J$$(B. $B$J$<$J$i(B, @samp{@{} $BJ8JB$S(B
                    684: @samp{@}}$B$,4{$KJ8$H$J$C$F$$$F(B, @code{if} $BJ8$NMW@A$rK~$?$7$F$$$k$+$i$G(B
                    685: $B$"$k(B.
1.3       noro      686: \E
                    687: \BEG
                    688: No terminator symbol is necessary after @samp{@}},
                    689: because @samp{@{} statement sequence @samp{@}} already forms a statement,
                    690: and it satisfies the syntactical requirement of the
                    691: `@code{if} statement.'
                    692: \E
1.1       noro      693:
1.3       noro      694: \BJP
1.1       noro      695: @node return $BJ8(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
                    696: @subsection @code{return} $BJ8(B
1.3       noro      697: \E
                    698: \BEG
                    699: @node return statement,,, Writing user defined functions
                    700: @subsection @code{return} statement
                    701: \E
1.1       noro      702:
                    703: @noindent
1.3       noro      704: \JP @code{return} $BJ8$O(B,
                    705: \EG There are two forms of @code{return} statement.
1.1       noro      706:
                    707: @example
1.3       noro      708: \JP return $B<0(B;
                    709: \EG return expression;
1.1       noro      710:
                    711: return;
                    712: @end example
                    713:
                    714: @noindent
1.3       noro      715: \BJP
1.1       noro      716: $B$N(B 2 $B$D$N7A<0$,$"$k(B. $B$$$:$l$bH!?t$+$iH4$1$k$?$a$NJ8$G$"$k(B. $BA0<T$O(B
                    717: $BH!?t$NCM$H$7$F(B $B<0(B $B$rJV$9(B. $B8e<T$G$O(B, $BH!?t$NCM$H$7$F2?$,JV$5$l$k$+(B
                    718: $B$O$o$+$i$J$$(B.
1.3       noro      719: \E
                    720: \BEG
                    721: Both forms are used for exiting from a function.
                    722: The former returns the value of the expression as a function value.
                    723: The function value of the latter is not defined.
                    724: \E
1.1       noro      725:
1.3       noro      726: \BJP
1.1       noro      727: @node if $BJ8(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
                    728: @subsection @code{if} $BJ8(B
1.3       noro      729: \E
                    730: \BEG
                    731: @node if statement,,, Writing user defined functions
                    732: @subsection @code{if} statement
                    733: \E
1.1       noro      734:
                    735: @noindent
1.3       noro      736: \JP @code{if} $BJ8$K$O(B
                    737: \EG There are two forms of @code{if} statement.
1.1       noro      738:
                    739: @example
1.3       noro      740: \BJP
1.1       noro      741: if ( $B<0(B )             if ( $B<0(B )
                    742:     $BJ8(B       $B5Z$S(B         $BJ8(B
                    743: else
                    744:     $BJ8(B
1.3       noro      745: \E
                    746: \BEG
                    747: if ( expression )             if ( expression )
                    748:      statement       and           statement
                    749: else
                    750:      statement
                    751: \E
1.1       noro      752: @end example
                    753:
                    754: @noindent
1.3       noro      755: \BJP
1.1       noro      756: $B$N(B 2 $B<oN`$,$"$k(B. $B$3$l$i$NF0:n$OL@$i$+$G$"$k$,(B, $BJ8$N0LCV$K(B @code{if} $BJ8(B
                    757: $B$,Mh$?>l9g$KCm0U$rMW$9$k(B. $B<!$NNc$r9M$($F$_$h$&(B.
1.3       noro      758: \E
                    759: \BEG
                    760: The interpretation of these forms are obvious.  However, be careful
                    761: when another @code{if} statement comes at the place for `statement'.
                    762: Let us examine the following example.
                    763: \E
1.1       noro      764:
                    765: @example
1.3       noro      766: \BJP
1.1       noro      767: if ( $B<0(B )
                    768:     if ( $B<0(B ) $BJ8(B
                    769: else
                    770:     $BJ8(B
1.3       noro      771: \E
                    772: \BEG
                    773: if ( expression1 )
                    774:     if ( expression2 ) statement1
                    775: else
                    776:     statement2
                    777: \E
1.1       noro      778: @end example
                    779:
                    780: @noindent
1.3       noro      781: \BJP
1.1       noro      782: $B$3$N>l9g(B, $B;z2<$2$+$i$O(B, @code{else} $B0J2<$O(B, $B:G=i$N(B @code{if} $B$KBP1~$9$k(B
                    783: $B$h$&$K8+$($k$,(B, $B%Q!<%6$O(B, $B<+F0E*$K(B 2 $BHVL\$N(B @code{if} $B$KBP1~$9$k$HH=CG$9$k(B.
                    784: $B$9$J$o$A(B, 2 $B<oN`$N(B @code{if} $BJ8$r5v$7$?$?$a$K(B, $BJ8K!$K[#Kf@-$,8=$l(B, $B$=$l$r(B
                    785: $B2r>C$9$k$?$a$K(B, @code{else} $B0J2<$O(B, $B:G$b6a$$(B @code{if} $B$KBP1~$9$k$H(B
                    786: $B$$$&5,B'$,E,MQ$5$l$k$N$G$"$k(B. $B=>$C$F(B, $B$3$NNc$O(B,
1.3       noro      787: \E
                    788: \BEG
                    789: One might guess @code{statement2} after @code{else} corresponds with the
                    790: first @code{if ( expression1 )} by its appearance of indentation.
                    791: But, as a matter of fact, the @code{Asir} parser decides that it
                    792: correspond with the second @code{if ( expression2 )}.
                    793: Ambiguity due to such two kinds of forms of @code{if} statement is
                    794: thus solved by introducing a rule that a statement preceded by an
                    795: @code{else} matches to the nearest preceding @code{if}.
                    796:
                    797: Therefore, rearrangement of the above example for improving readability
                    798: according to the actual interpretation gives the following.
                    799: \E
1.1       noro      800:
                    801: @example
1.3       noro      802: \BJP
1.1       noro      803: if ( $B<0(B ) @{
                    804:     if ( $B<0(B ) $BJ8(B else $BJ8(B
                    805: @}
1.3       noro      806: \E
                    807: \BEG
                    808: if ( expression1 ) @{
                    809:     if ( expression2 ) statement1 else statement2
                    810: @}
                    811: \E
1.1       noro      812: @end example
                    813:
                    814: @noindent
1.3       noro      815: \JP $B$H$$$&0UL#$H$J$k(B. $B;z2<$2$KBP1~$5$;$k$?$a$K$O(B,
                    816: \BEG
                    817: On the other hand, in order to reflect the indentation, it must be
                    818: written as the following.
                    819: \E
1.1       noro      820:
                    821: @example
1.3       noro      822: \BJP
1.1       noro      823: if ( $B<0(B ) @{
                    824:     if ( $B<0(B ) $BJ8(B
                    825: @} else
                    826:     $BJ8(B
1.3       noro      827: \E
                    828: \BEG
                    829: if ( expression1 ) @{
                    830:     if ( expression2 ) statement1
                    831: @} else
                    832:     statement2
                    833: \E
1.1       noro      834: @end example
                    835:
                    836: @noindent
1.3       noro      837: \JP $B$H$7$J$1$l$P$J$i$J$$(B.
1.1       noro      838:
1.3       noro      839: \BJP
1.1       noro      840: @node $B%k!<%W(B break return continue,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
                    841: @subsection $B%k!<%W(B, @code{break}, @code{return}, @code{continue}
1.3       noro      842: \E
                    843: \BEG
                    844: @node loop break return continue,,, Writing user defined functions
                    845: @subsection @code{loop}, @code{break}, @code{return}, @code{continue}
                    846: \E
1.1       noro      847:
                    848: @noindent
1.3       noro      849: \BJP
1.1       noro      850: $B%k!<%W$r9=@.$9$kJ8$O(B, @code{while} $BJ8(B, @code{for} $BJ8(B, @code{do} $BJ8(B
                    851: $B$N(B 3 $B<oN`$,$"$k(B.
1.3       noro      852: \E
                    853: \BEG
                    854: There are three kinds of statements for loops (repetitions):
                    855: the @code{while} statement, the @code{for} statement, and  the
                    856: @code{do} statement.
                    857: \E
1.1       noro      858:
                    859: @itemize @bullet
                    860: @item
1.3       noro      861: \JP @code{while} $BJ8(B
                    862: \EG @code{while} statement
1.4       noro      863: @*
1.3       noro      864: \JP $B7A<0$O(B,
                    865: \EG It has the following form.
1.1       noro      866:
                    867: @example
1.3       noro      868: \JP while ( $B<0(B ) $BJ8(B
                    869: \EG while ( expression ) statement
1.1       noro      870: @end example
                    871:
                    872: @noindent
1.3       noro      873: \BJP
1.1       noro      874: $B$G(B, $B$3$l$O(B, $B<0(B $B$rI>2A$7$F(B, $B$=$NCM$,(B 0 $B$G$J$$8B$j(B $BJ8(B $B$r<B9T$9$k$H$$$&(B
                    875: $B0UL#$H$J$k(B. $B$?$H$($P(B $B<0(B $B$,(B 1 $B$J$i$P(B, $BC1=c$JL58B%k!<%W$H$J$k(B.
1.3       noro      876: \E
                    877: \BEG
                    878: This statement specifies that @code{statement} is repeatedly evaluated
                    879: as far as the @code{expression} evaluates to a non-zero value.
                    880: If the expression 1 is given to the @code{expression}, it forms an
                    881: infinite loop.
                    882: \E
1.1       noro      883:
                    884: @item
1.3       noro      885: \JP @code{for} $BJ8(B
                    886: \EG @code{for} statement
1.4       noro      887: @*
1.3       noro      888: \JP $B7A<0$O(B,
                    889: \EG It has the following form.
1.1       noro      890:
                    891: @example
1.3       noro      892: \JP for ( $B<0JB$S(B-1; $B<0(B; $B<0JB$S(B-2 ) $BJ8(B
                    893: \EG for ( expression list-1; expression; expression list-2 ) statement
1.1       noro      894: @end example
                    895:
1.3       noro      896: \JP $B$G(B, $B$3$l$O(B
                    897: \EG This is equivalent to the program
1.1       noro      898:
                    899: @example
1.3       noro      900: \BJP
1.1       noro      901: $B<0JB$S(B-1 ($B$rC1J8JB$S$K$7$?$b$N(B)
                    902: while ( $B<0(B ) @{
                    903:     $BJ8(B
                    904:     $B<0JB$S(B-2 ($B$rC1J8JB$S$K$7$?$b$N(B)
                    905: @}
1.3       noro      906: \E
                    907: \BEG
                    908: expression list-1 (transformed into a sequence of simple statement)
                    909: while ( expression ) @{
                    910:     statement
                    911:     expression list-2 (transformed into a sequence of simple statement)
                    912: @}
                    913: \E
1.1       noro      914: @end example
                    915:
1.3       noro      916: \JP $B$HEy2A$G$"$k(B.
1.1       noro      917:
                    918: @item
1.3       noro      919: \JP @code{do} $BJ8(B
                    920: \EG @code{do} statement
1.4       noro      921: @*
1.1       noro      922: @example
1.3       noro      923: \BJP
1.1       noro      924: do @{
                    925:     $BJ8(B
                    926: @} while ( $B<0(B )
1.3       noro      927: \E
                    928: \BEG
                    929: do @{
                    930:     statement
                    931: @} while ( expression )
                    932: \E
1.1       noro      933: @end example
                    934:
1.3       noro      935: \BJP
1.1       noro      936: $B$O(B, $B@h$K(B $BJ8$r<B9T$7$F$+$i>r7o<0$K$h$kH=Dj$r9T$&=j$,(B @code{while} $BJ8(B
                    937: $B$H0[$J$C$F$$$k(B.
1.3       noro      938: \E
                    939: \BEG
                    940: This statement differs from @code{while} statement by the location of
                    941: the termination condition: This statement first execute the
                    942: @code{statement} and then check the condition, whereas @code{while}
                    943: statement does it in the reverse order.
                    944: \E
1.1       noro      945: @end itemize
                    946:
                    947: @noindent
1.3       noro      948: \BJP
1.1       noro      949: $B%k!<%W$rH4$1=P$9<jCJ$H$7$F(B,
                    950: @code{break} $BJ85Z$S(B @code{return} $BJ8$,$"$k(B. $B$^$?(B, $B%k!<%W$N@)8f$r(B
                    951: $B$"$k0LCV$K0\$9<jCJ$H$7$F(B @code{continue} $BJ8$,$"$k(B.
1.3       noro      952: \E
                    953: \BEG
                    954: As means for exiting from loops, there are @code{break} statement and
                    955: @code{return} statement.  The @code{continue} statement allows to move
                    956: the control to a certain point of the loop.
                    957: \E
1.1       noro      958: @itemize @bullet
                    959:
                    960: @item
                    961: @code{break}
1.4       noro      962: @*
1.3       noro      963: \JP @code{break} $BJ8$O(B, $B$=$l$r0O$`%k!<%W$r0l$D$@$1H4$1$k(B.
                    964: \EG The @code{break} statement is used to exit the inner most loop.
1.1       noro      965: @item
                    966: @code{return}
1.4       noro      967: @*
1.3       noro      968: \BJP
1.1       noro      969: @code{return} $BJ8$O(B, $B0lHL$KH!?t$+$iH4$1$k$?$a$NJ8$G$"$j(B,
                    970: $B%k!<%W$NCf$+$i$G$bM-8z$G$"$k(B.
1.3       noro      971: \E
                    972: \BEG
                    973: The @code{return} statement is usually used to exit from a function call
                    974: and it is also effective in a loop.
                    975: \E
1.1       noro      976:
                    977: @item
                    978: @code{continue}
1.4       noro      979: @*
1.3       noro      980: \BJP
1.1       noro      981: @code{continue} $BJ8$O(B, $B%k!<%W$NK\BN$NJ8$NKvC<$K@)8f$r0\$9(B.
                    982: $BNc$($P(B @code{for} $BJ8$G$O(B, $B:G8e$N<0JB$S$N<B9T$r9T$$(B, @code{while}
                    983: $BJ8$G$O>r7o<0$NH=Dj$K0\$k(B.
1.3       noro      984: \E
                    985: \BEG
                    986: The @code{continue} statement is used to move the control to the end
                    987: point of the loop body.
                    988: For example, the last expression list will be evaluated in a @code{for}
                    989: statement, and the termination condition will be evaluated in a
                    990: @code{while} statement.
                    991: \E
1.1       noro      992: @end itemize
1.5       noro      993:
                    994: \BJP
                    995: @node $B9=B$BNDj5A(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
                    996: @subsection $B9=B$BNDj5A(B
                    997: \E
                    998: \BEG
                    999: @node structure definition,,, Writing user defined functions
                   1000: @subsection structure definition
                   1001: \E
                   1002:
                   1003: \BJP
                   1004: $B9=B$BN$H$O(B, $B3F@.J,$NMWAG$,L>A0$G%"%/%;%9$G$-$k8GDjD9G[Ns$H;W$C$F$h$$(B.
                   1005: $B3F9=B$BN$OL>A0$G6hJL$5$l$k(B. $B9=B$BN$O(B, @code{struct} $BJ8$K$h$j@k8@$5$l$k(B.
                   1006: $B$"$k7?$N9=B$BN$O(B, $BAH$_9~$_4X?t(B @code{newstruct} $B$K$h$j@8@.$5$l$k(B.
                   1007: $B9=B$BN$N3F%a%s%P$O(B, $B1i;;;R(B @code{->} $B$K$h$j%"%/%;%9$9$k(B.
                   1008: $B%a%s%P$,9=B$BN$N>l9g(B, @code{->} $B$K$h$k;XDj$OF~$l;R$K$G$-$k(B.
                   1009: \E
                   1010:
                   1011: \BEG
                   1012: A structure data type is a fixed length array and each component of the array
                   1013: is accessed by its name. Each type of structure is distinguished by its name.
                   1014: A structure data type is declared by @code{struct} statement.
                   1015: A structure object is generated by a builtin function @code{newstruct}.
                   1016: Each member of a structure is accessed by an operatator @code{->}.
                   1017: If a member of a structure is again a structure, then the specification
                   1018: by @code{->} can be nested.
                   1019: \E
                   1020:
                   1021: @example
                   1022: [1] struct rat @{num,denom@};
                   1023: 0
                   1024: [2] A = newstruct(rat);
                   1025: @{0,0@}
                   1026: [3] A->num = 1;
                   1027: 1
                   1028: [4] A->den = 2;
                   1029: 2
                   1030: [5] A;
                   1031: @{1,2@}
                   1032: @end example
1.1       noro     1033:
1.3       noro     1034: \BJP
1.1       noro     1035: @node $B$5$^$6$^$J<0(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
                   1036: @subsection $B$5$^$6$^$J<0(B
1.3       noro     1037: \E
                   1038: \BEG
                   1039: @node various expressions,,, Writing user defined functions
                   1040: @subsection various expressions
                   1041: \E
1.1       noro     1042:
                   1043: @noindent
1.3       noro     1044: \JP $B<g$J<0$N9=@.MWAG$H$7$F$O(B, $B<!$N$h$&$J$b$N$,$"$k(B.
                   1045: \EG Major elements to construct expressions are the following:
1.1       noro     1046:
                   1047: @itemize @bullet
                   1048: @item
1.3       noro     1049: \JP $B2C8:>h=|(B, $BQQ(B
                   1050: \EG addition, subtraction, multiplication, division, exponentiation
1.4       noro     1051: @*
1.3       noro     1052: \BJP
1.1       noro     1053: $BQQ$O(B, @samp{^} $B$K$h$jI=$9(B. $B=|;;(B @samp{/} $B$O(B, $BBN$H$7$F$N1i;;$KMQ$$$k(B.
                   1054: $BNc$($P(B, @code{2/3} $B$OM-M}?t$N(B @code{2/3} $B$rI=$9(B.
                   1055: $B@0?t=|;;(B, $BB?9`<0=|;;(B ($B>jM>$r4^$`1i;;(B) $B$K$OJLESAH$_9~$_H!?t$,MQ0U$5$l$F$$$k(B.
1.3       noro     1056: \E
                   1057: \BEG
                   1058: The exponentiation is denoted by @samp{^}. (This differs from C language.)
                   1059: Division denoted by @samp{/} is used to operate in a field, for example,
                   1060: @code{2/3} results in a rational number @code{2/3}.
                   1061: For integer division and polynomial division, both including remainder
                   1062: operation, built-in functions are provided.
                   1063: \E
1.1       noro     1064:
                   1065: @example
                   1066: x+1  A^2*B*afo X/3
                   1067: @end example
                   1068:
                   1069: @item
1.3       noro     1070: \JP $B%$%s%G%C%/%9$D$-$NJQ?t(B
                   1071: \EG programming variables with indices
1.4       noro     1072: @*
1.3       noro     1073: \BJP
1.1       noro     1074: $B%Y%/%H%k(B, $B9TNs(B, $B%j%9%H$NMWAG$O%$%s%G%C%/%9$rMQ$$$k$3$H$K$h$j<h$j=P$;$k(B.
                   1075: $B%$%s%G%C%/%9$O(B 0 $B$+$i;O$^$k$3$H$KCm0U$9$k(B. $B<h$j=P$7$?MWAG$,%Y%/%H%k(B,
                   1076: $B9TNs(B, $B%j%9%H$J$i(B, $B$5$i$K%$%s%G%C%/%9$r$D$1$k$3$H$bM-8z$G$"$k(B.
1.3       noro     1077: \E
                   1078: \BEG
                   1079: An element of a vector, a matrix or a list can be referred to by
                   1080: indexing.
                   1081: Note that the indices begin with number 0.  When the referred element
                   1082: is again a vector, a matrix or a list, repeated indexing is also
                   1083: effective.
                   1084: \E
1.1       noro     1085:
                   1086: @example
                   1087: V[0] M[1][2]
                   1088: @end example
                   1089:
                   1090: @item
1.3       noro     1091: \JP $BHf3S1i;;(B
                   1092: \EG comparison operation
1.4       noro     1093: @*
1.3       noro     1094: \BJP
1.1       noro     1095: $BEy$7$$(B (@samp{==}), $BEy$7$/$J$$(B (@samp{!=}), $BBg>.(B (@samp{>}, @samp{<},
                   1096: @samp{>=}, @samp{<=}) $B$N(B 2 $B9`1i;;$,$"$k(B. $B??$J$i$PM-M}?t$N(B 1, $B56$J$i$P(B
                   1097: 0 $B$rCM$K;}$D(B.
1.3       noro     1098: \E
                   1099: \BEG
                   1100: There are comparison operations
                   1101: @samp{==} for equivalence, @samp{!=} for non-equivalence,
                   1102: @samp{>}, @samp{<},@samp{>=}, and @samp{<=} for larger or smaller.
                   1103: The results of these operations are either value 1 for the truth,
                   1104: or 0 for the false.
                   1105: \E
1.1       noro     1106:
                   1107: @item
1.3       noro     1108: \JP $BO@M}<0(B
                   1109: \EG logical expression
1.4       noro     1110: @*
1.3       noro     1111: \BJP
1.1       noro     1112: $BO@M}@Q(B (@samp{&&}), $BO@M}OB(B (@samp{||}) $B$N(B 2 $B9`1i;;$H(B, $BH]Dj(B (@samp{!})
                   1113: $B$,MQ0U$5$l$F$$$k(B. $BCM$O$d$O$j(B 1, 0 $B$G$"$k(B.
1.3       noro     1114: \E
                   1115: \BEG
                   1116: There are two binary logical operations
                   1117: @samp{&&} for logical @samp{conjunction}(and),
                   1118: @samp{||} for logical @samp{disjunction}(or),
                   1119: and one unary logical operation @samp{!} for logical @samp{negation}(not).
                   1120: The results of these operations are either value 1 for the truth,
                   1121: and 0 for the false.
                   1122: \E
1.1       noro     1123:
                   1124: @item
1.3       noro     1125: \JP $BBeF~(B
                   1126: \EG assignment
1.4       noro     1127: @*
1.3       noro     1128: \BJP
1.1       noro     1129: $BDL>o$NBeF~$O(B @samp{=} $B$G9T$&(B. $B$3$N$[$+(B, $B;;=Q1i;;;R$HAH$_9g$o$;$F(B
                   1130: $BFC<l$JBeF~$r9T$&$3$H$b$G$-$k(B.
1.3       noro     1131: \E
                   1132: \BEG
                   1133: Value assignment of a program variable is usually done by @samp{=}.
                   1134: There are special assignments combined with arithmetic operations.
                   1135: \E
1.1       noro     1136: (@samp{+=}, @samp{-=}, @samp{*=}, @samp{/=}, @samp{^=})
                   1137:
                   1138: @example
1.3       noro     1139: \JP A = 2  A *= 3 ($B$3$l$O(B A = A*3 $B$HF1$8(B; $B$=$NB>$N1i;;;R$bF1MM(B)
                   1140: \EG A = 2  A *= 3 (the same as A = A*3; The other combination are alike.)
1.1       noro     1141: @end example
                   1142: @item
1.3       noro     1143: \JP $BH!?t8F$S=P$7(B
                   1144: \EG function call
1.4       noro     1145: @*
1.3       noro     1146: \JP $BH!?t8F$S=P$7$b<0$N0l<o$G$"$k(B.
                   1147: \EG A function call is also an expression.
1.1       noro     1148: @item
                   1149: @samp{++}, @samp{--}
1.4       noro     1150: @*
1.3       noro     1151: \JP $B$3$l$i$O(B, $BJQ?t$NA08e$K$D$$$F(B, $B$=$l$>$l<!$N$h$&$JA`:n(B, $BCM$rI=$9(B.
                   1152: \BEG
                   1153: These operators are attached to or before a program variable,
                   1154: and denote special operations and values.
                   1155: \E
1.1       noro     1156: @example
1.3       noro     1157: \BJP
1.1       noro     1158: A++  $BCM$O85$N(B A $B$NCM(B, A = A+1
                   1159: A--  $BCM$O85$N(B A $B$NCM(B, A = A-1
                   1160: ++A  A = A+1, $BCM$OJQ2=8e$NCM(B
                   1161: --A  A = A-1, $BCM$OJQ2=8e$NCM(B
1.3       noro     1162: \E
                   1163: \BEG
                   1164: A++  the expression value is the previous value of A, and A = A+1
                   1165: A--  the expression value is the previous value of A, and A = A-1
                   1166: ++A  A = A+1, and the expression value is the value after increment of A
                   1167: --A  A = A-1, and the expression value is the value after decrement of A
                   1168: \E
1.1       noro     1169: @end example
                   1170:
                   1171: @end itemize
                   1172:
1.3       noro     1173: \BJP
1.1       noro     1174: @node $B%W%j%W%m%;%C%5(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
                   1175: @subsection $B%W%j%W%m%;%C%5(B
1.3       noro     1176: \E
                   1177: \BEG
                   1178: @node preprocessor,,, Writing user defined functions
                   1179: @subsection preprocessor
                   1180: \E
1.1       noro     1181:
                   1182: @noindent
1.3       noro     1183: \BJP
1.1       noro     1184: @b{Asir} $B$N%f!<%68@8l$O(B C $B8@8l$rLO$7$?$b$N$G$"$k(B. C $B$NFCD'$H$7$F(B,
                   1185: $B%W%j%W%m%;%C%5(B @code{cpp} $B$K$h$k%^%/%mE83+(B, $B%U%!%$%k$N%$%s%/%k!<%I(B
                   1186: $B$,$"$k$,(B, @b{Asir} $B$K$*$$$F$b%f!<%68@8l%U%!%$%k$NFI$_9~$_$N:](B
                   1187: @code{cpp} $B$rDL$7$F$+$iFI$_9~$`$3$H$H$7$?(B. $B$3$l$K$h$j%f!<%68@8l(B
                   1188: $B%U%!%$%kCf$G(B @code{#include}, @code{#define}, @code{#if} $B$J$I$,;H$($k(B.
1.3       noro     1189: \E
                   1190: \BEG
                   1191: he @b{Asir} user language imitates C language.  A typical features of
                   1192: C language include macro expansion and file inclusion by the
                   1193: preprocessor @code{cpp}.  Also, @b{Asir} read in user program files
                   1194: through @code{cpp}.  This enables @b{Asir} user to use
                   1195: @code{#include}, @code{#define}, @code{#if} etc. in his programs.
                   1196: \E
1.1       noro     1197:
                   1198: @itemize @bullet
                   1199: @item
                   1200: @code{#include}
1.4       noro     1201: @*
1.3       noro     1202: \BJP
1.1       noro     1203: @code{cpp} $B$KFC$K0z?t$rEO$5$J$$$?$a(B, $B%$%s%/%k!<%I%U%!%$%k$O(B,
                   1204: @code{#include} $B$,=q$+$l$F$$$k%U%!%$%k$HF1$8%G%#%l%/%H%j$G%5!<%A$5$l$k(B.
1.3       noro     1205: \E
                   1206: \BEG
                   1207: Include files are searched within the same directory as the file
                   1208: containing @code{#include} so that no arguments are passed to @code{cpp}.
                   1209: \E
1.1       noro     1210:
                   1211: @item
                   1212: @code{#define}
1.4       noro     1213: @*
1.3       noro     1214: \JP $B$3$l$O(B, C $B$K$*$1$k$N$HA4$/F1MM$KMQ$$$k$3$H$,$G$-$k(B.
                   1215: \EG This can be used just as in C language.
1.1       noro     1216:
                   1217: @item
                   1218: @code{#if}
1.4       noro     1219: @*
1.3       noro     1220: \BJP
1.1       noro     1221: @code{/*}, @code{*/} $B$K$h$k%3%a%s%H$OF~$l;R$K$G$-$J$$$N$G(B, $B%W%m%0%i%`(B
                   1222: $B$NBg$-$JItJ,$r%3%a%s%H%"%&%H$9$k:]$K(B, @code{#if 0}, @code{#endif}
                   1223: $B$r;H$&$HJXMx$G$"$k(B.
1.3       noro     1224: \E
                   1225: \BEG
                   1226: This is conveniently used to comment out a large part of a user program
                   1227: that may contain comments by @code{/*} and @code{*/},
                   1228: because such comments cannot be nested.
                   1229: \E
1.1       noro     1230: @end itemize
                   1231:
                   1232: @noindent
1.3       noro     1233: \JP $B<!$NNc$O(B, @samp{defs.h} $B$K$"$k%^%/%mDj5A$G$"$k(B.
                   1234: \EG the following are the macro definitions in @samp{defs.h}.
1.1       noro     1235:
                   1236: @example
                   1237: #define ZERO 0
                   1238: #define NUM 1
                   1239: #define POLY 2
                   1240: #define RAT 3
                   1241: #define LIST 4
                   1242: #define VECT 5
                   1243: #define MAT 6
                   1244: #define STR 7
                   1245: #define N_Q 0
                   1246: #define N_R 1
                   1247: #define N_A 2
                   1248: #define N_B 3
                   1249: #define N_C 4
                   1250: #define V_IND 0
                   1251: #define V_UC 1
                   1252: #define V_PF 2
                   1253: #define V_SR 3
                   1254: #define isnum(a) (type(a)==NUM)
                   1255: #define ispoly(a) (type(a)==POLY)
                   1256: #define israt(a) (type(a)==RAT)
                   1257: #define islist(a) (type(a)==LIST)
                   1258: #define isvect(a) (type(a)==VECT)
                   1259: #define ismat(a) (type(a)==MAT)
                   1260: #define isstr(a) (type(a)==STR)
                   1261: #define FIRST(L) (car(L))
                   1262: #define SECOND(L) (car(cdr(L)))
                   1263: #define THIRD(L) (car(cdr(cdr(L))))
                   1264: #define FOURTH(L) (car(cdr(cdr(cdr(L)))))
                   1265: #define DEG(a) deg(a,var(a))
                   1266: #define LCOEF(a) coef(a,deg(a,var(a)))
                   1267: #define LTERM(a) coef(a,deg(a,var(a)))*var(a)^deg(a,var(a))
                   1268: #define TT(a) car(car(a))
                   1269: #define TS(a) car(cdr(car(a)))
                   1270: #define MAX(a,b) ((a)>(b)?(a):(b))
                   1271: @end example
1.2       noro     1272:
                   1273:
1.3       noro     1274: \BJP
1.2       noro     1275: @node $B%*%W%7%g%s;XDj(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B
                   1276: @subsection $B%*%W%7%g%s;XDj(B
1.3       noro     1277: \E
                   1278: \BEG
                   1279: @node option,,, Writing user defined functions
                   1280: @subsection option
                   1281: \E
1.2       noro     1282:
1.3       noro     1283: \BJP
1.2       noro     1284: $B%f!<%6Dj5A4X?t$,(B @var{N} $BJQ?t$G@k8@$5$l$?>l9g(B, $B$=$N4X?t$O(B, @var{N}
                   1285: $BJQ?t$G$N8F$S=P$7$N$_$,5v$5$l$k(B.
1.3       noro     1286: \E
                   1287: \BEG
                   1288: If a user defined function is declared with @var{N} arguments,
                   1289: then the function is callable with @var{N} arguments only.
                   1290: \E
1.2       noro     1291:
                   1292: @example
                   1293: [0] def factor(A) @{ return fctr(A); @}
                   1294: [1] factor(x^5-1,3);
                   1295: evalf : argument mismatch in factor()
                   1296: return to toplevel
                   1297: @end example
                   1298:
1.3       noro     1299: \BJP
1.2       noro     1300: $BITDj8D0z?t$N4X?t$r%f!<%68@8l$G5-=R$7$?$$>l9g(B, $B%j%9%H(B, $BG[Ns$rMQ$$$k$3$H$G(B
                   1301: $B2DG=$H$J$k$,(B, $B<!$N$h$&$J$h$jJ,$+$j$d$9$$J}K!$b2DG=$G$"$k(B.
1.3       noro     1302: \E
                   1303: \BEG
                   1304: A function with indefinite number of arguments can be realized by
                   1305: using a list or an array as its argument. Another method is available
                   1306: as follows:
                   1307: \E
1.2       noro     1308:
                   1309: @example
                   1310: % cat factor
                   1311: def factor(F)
                   1312: @{
                   1313:     Mod = getopt(mod);
                   1314:     ModType = type(Mod);
                   1315:     if ( ModType == 1 ) /* 'mod' is not specified. */
                   1316:         return fctr(F);
                   1317:     else if ( ModType == 0 ) /* 'mod' is a number */
                   1318:         return modfctr(F,Mod);
                   1319: @}
                   1320: @end example
                   1321:
                   1322: @example
                   1323: [0] load("factor")$
                   1324: [1] factor(x^5-1);
                   1325: [[1,1],[x-1,1],[x^4+x^3+x^2+x+1,1]]
                   1326: [2] factor(x^5-1|mod=11);
                   1327: [[1,1],[x+6,1],[x+2,1],[x+10,1],[x+7,1],[x+8,1]]
                   1328: @end example
                   1329:
1.3       noro     1330: \BJP
1.2       noro     1331: 2 $BHVL\$N(B @code{factor()} $B$N8F$S=P$7$K$*$$$F(B, $B4X?tDj5A$N:]$K@k8@$5$l$?0z(B
1.3       noro     1332: $B?t(B @code{x^5-1}$B$N8e$m$K(B @code{|mod=11} $B$,CV$+$l$F$$$k(B. $B$3$l$O(B, $B4X?t<B9T;~(B
                   1333: $B$K(B, @code{mod} $B$H$$$&(B keyword $B$KBP$7$F(B @code{11} $B$H$$$&CM$r3d$jEv$F$k$3$H(B
1.2       noro     1334: $B$r;XDj$7$F$$$k(B. $B$3$l$r%*%W%7%g%s;XDj$H8F$V$3$H$K$9$k(B. $B$3$NCM$O(B
                   1335: @code{getopt(mod)} $B$G<h$j=P$9$3$H$,$G$-$k(B. 1 $BHVL\$N8F$S=P$7$N$h$&$K(B
1.3       noro     1336: @code{mod} $B$KBP$9$k%*%W%7%g%s;XDj$,$J$$>l9g$K$O(B, @code{getopt(mod)} $B$O7?(B
1.2       noro     1337: $B<1JL;R(B -1 $B$N%*%V%8%'%/%H$rJV$9(B. $B$3$l$K$h$j(B, $B;XDj$,$J$$>l9g$NF0:n$r(B if $BJ8(B
                   1338: $B$K$h$j5-=R$G$-$k(B. @samp{|} $B$N8e$m$K$O(B, $BG$0U8D$N%*%W%7%g%s$r(B, @samp{,}
                   1339: $B$G6h@Z$C$F;XDj$9$k$3$H$,$G$-$k(B.
1.3       noro     1340: \E
                   1341: \BEG
                   1342: In the second call of @code{factor()}, @code{|mod=11} is placed
                   1343: after the argument @code{x^5-1}, which appears in the declaration of
                   1344: @code{factor()}. This means that the value @code{11} is assigned to
                   1345: the keyword @code{mod} when the function is executed. The value
                   1346: can be retrieved by @code{getopt(mod)}. We call such machinery
                   1347: @var{option}. If the option for @var{mod} is not specified,
                   1348: @code{getopt(mod)} returns an object whose type is -1. By this
                   1349: feature, one can describe the behaviour of the function when
                   1350: the option is not specified by @var{if} statements.
                   1351: After @samp{|} one can append any number of options seperated by @samp{,}.
                   1352: \E
1.2       noro     1353: @example
                   1354: [100] xxx(1,2,x^2-1,[1,2,3]|proc=1,index=5);
                   1355: @end example
                   1356:
1.1       noro     1357:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>