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

Annotation of OpenXM/src/asir-doc/parts/builtin/function.texi, Revision 1.2

1.2     ! noro        1: @comment $OpenXM$
        !             2: \BJP
1.1       noro        3: @node $BH!?t$KBP$9$kA`:n(B,,, $BAH$_9~$_H!?t(B
                      4: @section $BH!?t$KBP$9$kA`:n(B
1.2     ! noro        5: \E
        !             6: \BEG
        !             7: @node Operations on functions,,, Built-in Function
        !             8: @section Operations on functions
        !             9: \E
1.1       noro       10:
                     11: @menu
                     12: * functor args funargs::
                     13: @end menu
                     14:
1.2     ! noro       15: \JP @node functor args funargs,,, $BH!?t$KBP$9$kA`:n(B
        !            16: \EG @node functor args funargs,,, Operations on functions
1.1       noro       17: @subsection @code{functor}, @code{args}, @code{funargs}
                     18: @findex functor
                     19: @findex args
                     20: @findex funargs
                     21:
                     22: @table @t
                     23: @item functor(@var{func})
1.2     ! noro       24: \JP :: @var{func} $B$NH!?t;R$r<h$j=P$9(B.
        !            25: \EG :: Functor of function form @var{func}.
1.1       noro       26: @item args(@var{func})
1.2     ! noro       27: \JP :: @var{func} $B$N0z?t%j%9%H$r<h$j=P$9(B.
        !            28: \EG :: List of arguments of function form @var{func}.
1.1       noro       29: @item funargs(@var{func})
1.2     ! noro       30: \JP :: @code{cons(functor(@var{func}),args(@var{func}))} $B$rJV$9(B.
        !            31: \EG :: @code{cons(functor(@var{func}),args(@var{func}))}.
1.1       noro       32: @end table
                     33:
                     34: @table @var
                     35: @item return
1.2     ! noro       36: \JP @code{functor()} : $BITDj85(B, @code{args()}, @code{funargs()} : $B%j%9%H(B
        !            37: \EG @code{functor()} : indeterminate, @code{args()}, @code{funargs()} : list
1.1       noro       38: @item func
1.2     ! noro       39: \JP $BH!?t7A<0$rI=$9ITDj85(B
        !            40: \EG function form
1.1       noro       41: @end table
                     42:
                     43: @itemize @bullet
1.2     ! noro       44: \BJP
1.1       noro       45: @item
                     46: $BH!?t7A<0$K4X$7$F$O(B, @code{vtype()} $B$r;2>H(B.
                     47: @item
                     48: $BH!?t7A<0(B @var{func} $B$NH!?t;R(B, $B0z?t%j%9%H$r<h$j=P$9(B.
                     49: @item
                     50: $B5U$K(B, $B<h$j=P$7$?H!?t;R$rCM$K;}$D%W%m%0%i%`JQ?t$r(B @code{F} $B$H$9$l$P(B (@code{*F})(x) $B$G(B
                     51: x $B$r0z?t$H$9$kH!?t8F$S=P$7$^$?$OH!?t7A<0$,F~NO$G$-$k(B.
1.2     ! noro       52: \E
        !            53: \BEG
        !            54: @item
        !            55: @xref{vtype} for function form.
        !            56: @item
        !            57: Extract the functor and  the arguments of function form @var{func}.
        !            58: @item
        !            59: Assign a program variable, say @code{F}, to the functor obtained
        !            60: by @code{functor()}.  Then, you can type (@code{*F})(x)
        !            61: (, or (@code{*F})(x,y,...)
        !            62: depending on the arity,) to input a function form with argument x.
        !            63: \E
1.1       noro       64: @end itemize
                     65:
                     66: @example
                     67: [0] functor(sin(x));
                     68: sin
                     69: [0] args(sin(x));
                     70: [x]
                     71: [0] funargs(sin(3*cos(y)));
                     72: [sin,3*cos(y)]
                     73: [1] for (L=[sin,cos,tan];L!=[];L=cdr(L)) @{A=car(L); print(eval((*A)(@@pi/3)));@}
                     74: 0.86602540349122136831
                     75: 0.5000000002
                     76: 1.7320508058
                     77: @end example
                     78:
                     79: @table @t
1.2     ! noro       80: \JP @item $B;2>H(B
        !            81: \EG @item References
1.1       noro       82: @fref{vtype}.
                     83: @end table
                     84:

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