version 1.15, 2004/07/03 15:50:34 |
version 1.18, 2005/07/25 12:23:05 |
|
|
@comment $OpenXM: OpenXM/src/asir-doc/parts/asir.texi,v 1.14 2003/12/21 17:36:29 ohara Exp $ |
@comment $OpenXM: OpenXM/src/asir-doc/parts/asir.texi,v 1.17 2004/07/10 05:50:57 takayama Exp $ |
\BJP |
\BJP |
@node $B%f!<%68@8l(B Asir,,, Top |
@node $B%f!<%68@8l(B Asir,,, Top |
@chapter $B%f!<%68@8l(B Asir |
@chapter $B%f!<%68@8l(B Asir |
Line 1456 After @samp{|} one can append any number of options se |
|
Line 1456 After @samp{|} one can append any number of options se |
|
@samp{,} $B$G6h@Z$C$FEO$9Be$o$j$K(B, $BFCJL$J%-!<%o!<%I(B @code{option_list} |
@samp{,} $B$G6h@Z$C$FEO$9Be$o$j$K(B, $BFCJL$J%-!<%o!<%I(B @code{option_list} |
$B$H%*%W%7%g%s%j%9%H(B @code{[["key1",value1],["key2",value2],...]} |
$B$H%*%W%7%g%s%j%9%H(B @code{[["key1",value1],["key2",value2],...]} |
$B$rMQ$$$FEO$9$3$H$b2DG=$G$"$k(B. |
$B$rMQ$$$FEO$9$3$H$b2DG=$G$"$k(B. |
|
\E |
|
\BEG |
|
Optinal arguments may be given as a list |
|
with the key word @code{option_list} |
|
as |
|
@code{option_list=[["key1",value1],["key2",value2],...]}. |
|
It is equivalent to pass the optional arguments as |
|
@code{key1=value1,key2=value2,...}. |
|
\E |
|
|
@example |
@example |
[101] dp_gr_main([x^2+y^2-1,x*y-1]|option_list=[["v",[x,y]],["order",[[x,5,y,1]]]]); |
[101] dp_gr_main([x^2+y^2-1,x*y-1]|option_list=[["v",[x,y]],["order",[[x,5,y,1]]]]); |
@end example |
@end example |
|
|
|
\BJP |
$BFC$K(B, $B0z?t$J$7$N(B @code{getopt()} $B$O%*%W%7%g%s%j%9%H$rJV$9$N$G(B, |
$BFC$K(B, $B0z?t$J$7$N(B @code{getopt()} $B$O%*%W%7%g%s%j%9%H$rJV$9$N$G(B, |
$B%*%W%7%g%s$r$H$k4X?t$+$i(B, $B%*%W%7%g%s$r$H$k4X?t$r8F$S=P$9$H$-$K$OM-MQ$G$"$k(B. |
$B%*%W%7%g%s$r$H$k4X?t$+$i(B, $B%*%W%7%g%s$r$H$k4X?t$r8F$S=P$9$H$-$K$OM-MQ$G$"$k(B. |
|
\E |
|
\BEG |
|
Since @code{getopt()} returns an option list, |
|
the optional argument @code{option_list=...} is useful when |
|
we call functions with optional arguments from |
|
a function with optional arguments to pass |
|
the all optional parameters. |
|
\E |
|
|
@example |
@example |
% cat foo.rr |
% cat foo.rr |
|
|
[4] foo(x^5-1|mod=11); |
[4] foo(x^5-1|mod=11); |
[[1,1],[x+6,1],[x+2,1],[x+10,1],[x+7,1],[x+8,1]] |
[[1,1],[x+6,1],[x+2,1],[x+10,1],[x+7,1],[x+8,1]] |
@end example |
@end example |
\E |
|
|
|
\BJP |
\BJP |
@node $B%b%8%e!<%k(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B |
@node $B%b%8%e!<%k(B,,, $B%f!<%6Dj5AH!?t$N=q$-J}(B |
Line 1615 The below is an example of demand loading. |
|
Line 1632 The below is an example of demand loading. |
|
\E |
\E |
|
|
@example |
@example |
if (!module_definep("stack")) load("stack.rr") $ |
if (!module_definedp("stack")) load("stack.rr") $ |
@end example |
@end example |
|
|
\BJP |
\BJP |
|
|
module stack; |
module stack; |
/* The body of the module stack */ |
/* The body of the module stack */ |
endmodule; |
endmodule; |
|
@end example |
|
|
|
\BJP |
|
$B%b%8%e!<%k$NCf$+$i%H%C%W%l%Y%k$GDj5A$5$l$F$$$k4X?t$r8F$V$K$O(B, |
|
$B2<$NNc$N$h$&$K(B @code{::} $B$rMQ$$$k(B. |
|
\E |
|
\BEG |
|
In order to call functions defined in the top level from the inside |
|
of a module, we use @code{::} as in the example below. |
|
\E |
|
@example |
|
def afo() @{ |
|
S = "afo, afo"; |
|
return S; |
|
@} |
|
module abc; |
|
localf foo,afo $ |
|
|
|
def foo() @{ |
|
G = ::afo(); |
|
return G; |
|
@} |
|
def afo() @{ |
|
return "afo, afo in abc"; |
|
@} |
|
endmodule; |
|
end$ |
|
|
|
[1200] abc.foo(); |
|
afo, afo |
|
[1201] abc.afo(); |
|
afo, afo in abc |
@end example |
@end example |
|
|
@table @t |
@table @t |