construct a function expression - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Operations : Operators : apply

apply - construct a function expression

Calling Sequence

apply(p, rest)

Parameters

p

-

procedure or name to be applied

rest

-

(optional) expression sequence of arguments to be passed to p

Description

• 

The apply(p, rest) calling sequence returns the expression prest.

• 

Using unapply, the apply procedure satisfies the functional equation apply(unapply(p, v), op(v)) = p.

Examples

applyg

g

(1)

applyf,s

fs

(2)

applyf,s,t,u,v

fs,t,u,v

(3)

applysin,π

0

(4)

mapapply,sin,cos,tan,π

0,1,0

(5)

applyunapplyx2,ⅇx,x,x,2

4,ⅇ2,2

(6)

applyunapplyx2+y2,x,y,a,b

a2+b2

(7)

map(proc(n)
    description "an anonymous and recursive procedure";
        (x -> apply(x, x))(f -> proc(p, c)
                                    if c > n then
                                            p
                                    else
                                            (f(f))(p * c, 1 + c)
                                    end if
                                end proc)(1, 1)
    end proc, [$ 1 .. 10]);

1,2,6,24,120,720,5040,40320,362880,3628800

(8)

See Also

curry, eval, evalapply, function, type[appliable], type[function], unapply


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