evalapply - Maple Help

evalapply

user definable control over function application

 Calling Sequence evalapply/V(f, t))

Parameters

 f - function call t - list of arguments

Description

 • When nontrivial Maple objects such as unevaluated function calls, lists, or sets are applied to arguments as if they were functions, the evalapply command determines the outcome. For example, an object of type function can be applied to arguments, as in V(f, g)(a, b, c).
 • The effect of applying the result of most built-in constructors to a sequence of arguments is determined by an internal evalapply function. The evalapply command also implements the application semantics for compositions and compositional powers.
 • The effect of applying a function call to arguments can be specified by defining an optional procedure of the name evalapply/V, where V is the name of the function.
 • When present, the procedure of the name evalapply/V is automatically invoked with f set to V(f, g), and t set to [a, b, c] in response to the function invocation V(f, g)(a, b, c).

Examples of Function Application

 > V(f,g)(a,b,c);
 ${V}{}\left({f}{,}{g}\right){}\left({a}{,}{b}{,}{c}\right)$ (1)
 > evalapply/V := proc(f,t) local i;   V(seq(op(i,f)(op(t)),i=1..nops(f))); end proc:
 > V(f,g)(a,b,c);
 ${V}{}\left({f}{}\left({a}{,}{b}{,}{c}\right){,}{g}{}\left({a}{,}{b}{,}{c}\right)\right)$ (2)
 > [a,b](x,y);
 $\left[{a}{}\left({x}{,}{y}\right){,}{b}{}\left({x}{,}{y}\right)\right]$ (3)
 > {a,b}(x,y);
 $\left\{{a}{}\left({x}{,}{y}\right){,}{b}{}\left({x}{,}{y}\right)\right\}$ (4)
 > (a=b)(x,y);
 ${a}{}\left({x}{,}{y}\right){=}{b}{}\left({x}{,}{y}\right)$ (5)
 > (a+b)(x,y);
 ${a}{}\left({x}{,}{y}\right){+}{b}{}\left({x}{,}{y}\right)$ (6)
 > (a-b)(x,y);
 ${a}{}\left({x}{,}{y}\right){-}{b}{}\left({x}{,}{y}\right)$ (7)
 > (a*b)(x,y);
 ${a}{}\left({x}{,}{y}\right){}{b}{}\left({x}{,}{y}\right)$ (8)
 > (a/b)(x,y);
 $\frac{{a}{}\left({x}{,}{y}\right)}{{b}{}\left({x}{,}{y}\right)}$ (9)
 > (a^b)(x,y);
 ${{a}{}\left({x}{,}{y}\right)}^{{b}{}\left({x}{,}{y}\right)}$ (10)
 > (a.b)(x,y);
 ${a}{}\left({x}{,}{y}\right){.}{b}{}\left({x}{,}{y}\right)$ (11)
 > (a,b)(x,y);
 ${a}{}\left({x}{,}{y}\right){,}{b}{}\left({x}{,}{y}\right)$ (12)
 > (a..b)(x,y);
 ${a}{}\left({x}{,}{y}\right){..}{b}{}\left({x}{,}{y}\right)$ (13)
 > (a and b)(x,y);
 ${a}{}\left({x}{,}{y}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{and}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{b}{}\left({x}{,}{y}\right)$ (14)
 > (a or b)(x,y);
 ${a}{}\left({x}{,}{y}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{or}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{b}{}\left({x}{,}{y}\right)$ (15)
 > (a xor b)(x,y);
 ${a}{}\left({x}{,}{y}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{xor}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{b}{}\left({x}{,}{y}\right)$ (16)
 > (a implies b)(x,y);
 ${a}{}\left({x}{,}{y}\right){⇒}{b}{}\left({x}{,}{y}\right)$ (17)
 > (not a)(x,y);
 ${\mathbf{not}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{a}{}\left({x}{,}{y}\right)$ (18)
 > (a@b)(x,y);
 ${a}{}\left({b}{}\left({x}{,}{y}\right)\right)$ (19)
 > (a@@n)(a(x,y));
 ${{a}}^{\left({n}{+}{1}\right)}{}\left({x}{,}{y}\right)$ (20)
 > combinat['choose']( 4, 3 );
 $\left[\left[{1}{,}{2}{,}{3}\right]{,}\left[{1}{,}{2}{,}{4}\right]{,}\left[{1}{,}{3}{,}{4}\right]{,}\left[{2}{,}{3}{,}{4}\right]\right]$ (21)
 > map( {op}, combinat['choose']( 4, 3 ) );
 $\left[\left\{{1}{,}{2}{,}{3}\right\}{,}\left\{{1}{,}{2}{,}{4}\right\}{,}\left\{{1}{,}{3}{,}{4}\right\}{,}\left\{{2}{,}{3}{,}{4}\right\}\right]$ (22)