user definable control over function application - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Procedures and Functions : evalapply

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);

Vf,ga,b,c

(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);

Vfa,b,c,ga,b,c

(2)

[a,b](x,y);

ax,y,bx,y

(3)

{a,b}(x,y);

ax,y,bx,y

(4)

(a=b)(x,y);

ax,y=bx,y

(5)

(a+b)(x,y);

ax,y+bx,y

(6)

(a-b)(x,y);

ax,ybx,y

(7)

(a*b)(x,y);

ax,ybx,y

(8)

(a/b)(x,y);

ax,ybx,y

(9)

(a^b)(x,y);

ax,ybx,y

(10)

(a.b)(x,y);

ax,y.bx,y

(11)

(a,b)(x,y);

ax,y,bx,y

(12)

(a..b)(x,y);

ax,y..bx,y

(13)

(a and b)(x,y);

ax,yandbx,y

(14)

(a or b)(x,y);

ax,yorbx,y

(15)

(a xor b)(x,y);

ax,yxorbx,y

(16)

(a implies b)(x,y);

ax,ybx,y

(17)

(not a)(x,y);

notax,y

(18)

(a@b)(x,y);

abx,y

(19)

(a@@n)(a(x,y));

an+1x,y

(20)

combinat['choose']( 4, 3 );

1,2,3,1,2,4,1,3,4,2,3,4

(21)

map( {op}, combinat['choose']( 4, 3 ) );

1,2,3,1,2,4,1,3,4,2,3,4

(22)

See Also

apply, eval, type/appliable, type/function


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam