@comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/function.texi,v 1.5 2003/12/20 20:05:02 ohara Exp $ \BJP @node 函数に対する操作,,, 組み込み函数 @section 函数に対する操作 \E \BEG @node Operations on functions,,, Built-in Function @section Operations on functions \E @menu * call:: * functor args funargs:: @end menu \JP @node call,,, 函数に対する操作 \EG @node call,,, Operations on functions @subsection @code{call} @findex call @table @t @item call(@var{name}, @var{args}) \JP :: 函数 @var{name} を呼び出す. \EG :: Call the function @var{name} with @var{args}. @end table @table @var @item return \JP 函数 @code{name()} の返り値. \EG a return value of @code{name()}. @item name \JP 函数名を表す不定元(函数子とは限らない) \EG indefinite (function name) @item args \JP 引数のリスト \EG a list of arguments @end table @itemize @bullet \BJP @item 函数子に関しては, @code{vtype()} を参照. @item 引数の個数があらかじめ分かっているときは @code{(*@var{name})()} の形式, 分からないときは @code{call()} を使うとよい. \E \BEG @item See @ref{vtype} for function form. \E @end itemize @example [0] A=igcd; igcd [1] call(A,[4,6]); 2 [2] (*A)(4,6); 2 @end example @table @t \JP @item 参照 \EG @item References @fref{vtype}. @end table \JP @node functor args funargs,,, 函数に対する操作 \EG @node functor args funargs,,, Operations on functions @subsection @code{functor}, @code{args}, @code{funargs} @findex functor @findex args @findex funargs @table @t @item functor(@var{func}) \JP :: @var{func} の函数子を取り出す. \EG :: Functor of function form @var{func}. @item args(@var{func}) \JP :: @var{func} の引数リストを取り出す. \EG :: List of arguments of function form @var{func}. @item funargs(@var{func}) \JP :: @code{cons(functor(@var{func}),args(@var{func}))} を返す. \EG :: @code{cons(functor(@var{func}),args(@var{func}))}. @end table @table @var @item return \JP @code{functor()} : 不定元, @code{args()}, @code{funargs()} : リスト \EG @code{functor()} : indeterminate, @code{args()}, @code{funargs()} : list @item func \JP 函数形式を表す不定元 \EG function form @end table @itemize @bullet \BJP @item 函数形式に関しては, @code{vtype()} を参照. @item 函数形式 @var{func} の函数子, 引数リストを取り出す. @item 逆に, 取り出した函数子を値に持つプログラム変数を @code{F} とすれば (@code{*F})(x) で x を引数とする函数呼び出しまたは函数形式が入力できる. \E \BEG @item See @ref{vtype} for function form. @item Extract the functor and the arguments of function form @var{func}. @item Assign a program variable, say @code{F}, to the functor obtained by @code{functor()}. Then, you can type (@code{*F})(x) (, or (@code{*F})(x,y,...) depending on the arity,) to input a function form with argument x. \E @end itemize @example [0] functor(sin(x)); sin [0] args(sin(x)); [x] [0] funargs(sin(3*cos(y))); [sin,3*cos(y)] [1] for (L=[sin,cos,tan];L!=[];L=cdr(L)) @{A=car(L); print(eval((*A)(@@pi/3)));@} 0.86602540349122136831 0.5000000002 1.7320508058 @end example @table @t \JP @item 参照 \EG @item References @fref{vtype}. @end table