TU-Berlin → Inst. f. Mathematik → Algebra und Zahlentheorie → KASH → Documentation → Reference Manual
KASH3 Reference Manual




function ( [ <arg-ident> {, <arg-ident>} ] ) [ local <loc-ident> {, <loc-ident>} ; ] <statements> end;


A function is in fact a literal and not a statement. Such a function literal can be assigned to a variable or to a list element or a record component.

Because for each of the formal arguments <arg-ident> and for each of the formal locals <loc-ident> a new variable is allocated when the function is called, it is possible that a function calls itself. This is usually called recursion.

When a function <fun1> definition is evaluated inside another function <fun2>, KASH binds all the identifiers inside the function <fun1> that are identifiers of an argument or a local of <fun2> to the corresponding variable. This set of bindings is called the environment of the function <fun1>. When <fun1> is called, its body is executed in this environment.

In KASH (by convention) the names of function which return nothing and act destructively on the input end in '_'.

See also

Built: Mon Nov 14 21:12:39 UTC 2005 on mack
The KANT Group