CoCoA:Function

From ApCoCoAWiki

Function

return a function

Description

This function returns the function---user-defined or built

in---identified by the string S. In the second form, one first

provides the name of the package, then the name of the function. (An alternative is the syntax Function(P.S).

One may use Function to assign a function to a variable which can

then be executed via the function <ttref>Call</ttref>:

Example

  F := Function(<quotes>Deg</quotes>);
  F;
Deg(...)
-------------------------------
  Type(F);
FUNCTION
-------------------------------
  Call(F,x+y^2);
2
-------------------------------
  -- the Call-statement here is equivalent to:
  Deg(x+y^2);
2
-------------------------------
  Function(<quotes>Insert</quotes>);
Insert(L,I,O)
-------------------------------
  Function(<quotes>$list</quotes>,<quotes>Insert</quotes>); -- or <quotes>Function(<quotes>$list.Insert</quotes>)</quotes>
  Insert(L,I,O)
-------------------------------

Syntax

Function(S:STRING):FUNCTION
Function(P:STRING,S:STRING):FUNCTION

Call

Functions

   <type>function</type>